diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c1d943c0d0..4b173d25f2 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -17,7 +17,7 @@ "rollForward": false }, "dotnet-reportgenerator-globaltool": { - "version": "5.4.4", + "version": "5.4.5", "commands": [ "reportgenerator" ], @@ -29,6 +29,13 @@ "docfx" ], "rollForward": false + }, + "microsoft.openapi.kiota": { + "version": "1.25.1", + "commands": [ + "kiota" + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..0c78db34f3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# When running OpenAPI tests, these committed files are downloaded and written to disk (so we'll know when something changes). +# On Windows, these text files are auto-converted to crlf on git fetch, while the written downloaded files use lf line endings. +# Therefore, running the tests on Windows creates local changes. Staging them auto-converts back to crlf, which undoes the changes. +# To avoid this annoyance, the next line opts out of the auto-conversion and forces line endings to lf. +**/GeneratedSwagger/**/*.json text eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37878e5e4a..7ee1333bd6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,14 +72,14 @@ jobs: $versionSuffix = $segments.Length -eq 1 ? '' : $segments[1..$($segments.Length - 1)] -join '-' [xml]$xml = Get-Content Directory.Build.props - $configuredVersionPrefix = $xml.Project.PropertyGroup.JsonApiDotNetCoreVersionPrefix | Select-Object -First 1 + $configuredVersionPrefix = $xml.Project.PropertyGroup.VersionPrefix | Select-Object -First 1 if ($configuredVersionPrefix -ne $versionPrefix) { Write-Error "Version prefix from git release tag '$versionPrefix' does not match version prefix '$configuredVersionPrefix' stored in Directory.Build.props." # To recover from this: # - Delete the GitHub release # - Run: git push --delete origin the-invalid-tag-name - # - Adjust JsonApiDotNetCoreVersionPrefix in Directory.Build.props, commit and push + # - Adjust VersionPrefix in Directory.Build.props, commit and push # - Recreate the GitHub release } } @@ -284,4 +284,4 @@ jobs: NUGET_ORG_API_KEY: ${{ secrets.NUGET_ORG_API_KEY }} shell: pwsh run: | - dotnet nuget push "$env:GITHUB_WORKSPACE/packages/*.nupkg" --api-key "$env:NUGET_ORG_API_KEY" --source 'nuget.org' + dotnet nuget push "$env:GITHUB_WORKSPACE/packages/*.nupkg" --api-key "$env:NUGET_ORG_API_KEY" --source 'nuget.org' --skip-duplicate diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d3d4db6142..508d210158 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -35,6 +35,9 @@ jobs: uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} + - name: Restore .NET tools + run: | + dotnet tool restore - name: Autobuild uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis diff --git a/Build.ps1 b/Build.ps1 index 0b2bbb40f1..6c6ff9c13a 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,5 +1,3 @@ -$versionSuffix="pre" - function VerifySuccessExitCode { if ($LastExitCode -ne 0) { throw "Command failed with exit code $LastExitCode." @@ -16,7 +14,7 @@ Remove-Item -Recurse -Force * -Include coverage.cobertura.xml dotnet tool restore VerifySuccessExitCode -dotnet build --configuration Release /p:VersionSuffix=$versionSuffix +dotnet build --configuration Release VerifySuccessExitCode dotnet test --no-build --configuration Release --verbosity quiet --collect:"XPlat Code Coverage" @@ -25,5 +23,5 @@ VerifySuccessExitCode dotnet reportgenerator -reports:**\coverage.cobertura.xml -targetdir:artifacts\coverage -filefilters:-*.g.cs VerifySuccessExitCode -dotnet pack --no-build --configuration Release --output artifacts/packages /p:VersionSuffix=$versionSuffix +dotnet pack --no-build --configuration Release --output artifacts/packages VerifySuccessExitCode diff --git a/CSharpGuidelinesAnalyzer.config b/CSharpGuidelinesAnalyzer.config index 89b568e155..6d5453159a 100644 --- a/CSharpGuidelinesAnalyzer.config +++ b/CSharpGuidelinesAnalyzer.config @@ -1,5 +1,5 @@ - + diff --git a/Directory.Build.props b/Directory.Build.props index 7adc228bff..8fb62a916f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,9 @@ Recommended $(MSBuildThisFileDirectory)CodingGuidelines.ruleset $(MSBuildThisFileDirectory)tests.runsettings - 5.6.1 + 5.6.1 + pre + 1 direct $(NoWarn);NETSDK1215 diff --git a/JsonApiDotNetCore.sln b/JsonApiDotNetCore.sln index c555610364..793c01950d 100644 --- a/JsonApiDotNetCore.sln +++ b/JsonApiDotNetCore.sln @@ -62,6 +62,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DapperExample", "src\Exampl EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DapperTests", "test\DapperTests\DapperTests.csproj", "{80E322F5-5F5D-4670-A30F-02D33C2C7900}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.OpenApi.Swashbuckle", "src\JsonApiDotNetCore.OpenApi.Swashbuckle\JsonApiDotNetCore.OpenApi.Swashbuckle.csproj", "{71287D6F-6C3B-44B4-9FCA-E78FE3F02289}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiTests", "test\OpenApiTests\OpenApiTests.csproj", "{B693DE14-BB28-496F-AB39-B4E674ABCA80}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.OpenApi.Client.NSwag", "src\JsonApiDotNetCore.OpenApi.Client.NSwag\JsonApiDotNetCore.OpenApi.Client.NSwag.csproj", "{5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiNSwagClientExample", "src\Examples\OpenApiNSwagClientExample\OpenApiNSwagClientExample.csproj", "{7FC5DFA3-6F66-4FD8-820D-81E93856F252}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiNSwagClientTests", "test\OpenApiNSwagClientTests\OpenApiNSwagClientTests.csproj", "{77F98215-3085-422E-B99D-4C404C2114CF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiNSwagEndToEndTests", "test\OpenApiNSwagEndToEndTests\OpenApiNSwagEndToEndTests.csproj", "{3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.OpenApi.Client.Kiota", "src\JsonApiDotNetCore.OpenApi.Client.Kiota\JsonApiDotNetCore.OpenApi.Client.Kiota.csproj", "{617FCA5D-A2DE-4083-B373-ADCA9901059F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiKiotaClientExample", "src\Examples\OpenApiKiotaClientExample\OpenApiKiotaClientExample.csproj", "{39DEAFE8-AE29-48E5-A67D-73776D70FC82}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenApiKiotaEndToEndTests", "test\OpenApiKiotaEndToEndTests\OpenApiKiotaEndToEndTests.csproj", "{FD86C676-3D80-4971-8D8C-B0729B2251F6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -312,6 +330,114 @@ Global {80E322F5-5F5D-4670-A30F-02D33C2C7900}.Release|x64.Build.0 = Release|Any CPU {80E322F5-5F5D-4670-A30F-02D33C2C7900}.Release|x86.ActiveCfg = Release|Any CPU {80E322F5-5F5D-4670-A30F-02D33C2C7900}.Release|x86.Build.0 = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|x64.ActiveCfg = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|x64.Build.0 = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|x86.ActiveCfg = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Debug|x86.Build.0 = Debug|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|Any CPU.Build.0 = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|x64.ActiveCfg = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|x64.Build.0 = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|x86.ActiveCfg = Release|Any CPU + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289}.Release|x86.Build.0 = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|x64.ActiveCfg = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|x64.Build.0 = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|x86.ActiveCfg = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Debug|x86.Build.0 = Debug|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|Any CPU.Build.0 = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|x64.ActiveCfg = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|x64.Build.0 = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|x86.ActiveCfg = Release|Any CPU + {B693DE14-BB28-496F-AB39-B4E674ABCA80}.Release|x86.Build.0 = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|x64.ActiveCfg = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|x64.Build.0 = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|x86.ActiveCfg = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Debug|x86.Build.0 = Debug|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|Any CPU.Build.0 = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|x64.ActiveCfg = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|x64.Build.0 = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|x86.ActiveCfg = Release|Any CPU + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C}.Release|x86.Build.0 = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|x64.ActiveCfg = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|x64.Build.0 = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|x86.ActiveCfg = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Debug|x86.Build.0 = Debug|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|Any CPU.Build.0 = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|x64.ActiveCfg = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|x64.Build.0 = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|x86.ActiveCfg = Release|Any CPU + {7FC5DFA3-6F66-4FD8-820D-81E93856F252}.Release|x86.Build.0 = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|x64.ActiveCfg = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|x64.Build.0 = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|x86.ActiveCfg = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Debug|x86.Build.0 = Debug|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|Any CPU.Build.0 = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|x64.ActiveCfg = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|x64.Build.0 = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|x86.ActiveCfg = Release|Any CPU + {77F98215-3085-422E-B99D-4C404C2114CF}.Release|x86.Build.0 = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|x64.ActiveCfg = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|x64.Build.0 = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|x86.ActiveCfg = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Debug|x86.Build.0 = Debug|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|Any CPU.Build.0 = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|x64.ActiveCfg = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|x64.Build.0 = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|x86.ActiveCfg = Release|Any CPU + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225}.Release|x86.Build.0 = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|x64.ActiveCfg = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|x64.Build.0 = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|x86.ActiveCfg = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Debug|x86.Build.0 = Debug|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|Any CPU.Build.0 = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|x64.ActiveCfg = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|x64.Build.0 = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|x86.ActiveCfg = Release|Any CPU + {617FCA5D-A2DE-4083-B373-ADCA9901059F}.Release|x86.Build.0 = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|x64.ActiveCfg = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|x64.Build.0 = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|x86.ActiveCfg = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Debug|x86.Build.0 = Debug|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|Any CPU.Build.0 = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|x64.ActiveCfg = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|x64.Build.0 = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|x86.ActiveCfg = Release|Any CPU + {39DEAFE8-AE29-48E5-A67D-73776D70FC82}.Release|x86.Build.0 = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|x64.ActiveCfg = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|x64.Build.0 = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|x86.ActiveCfg = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Debug|x86.Build.0 = Debug|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|Any CPU.Build.0 = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|x64.ActiveCfg = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|x64.Build.0 = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|x86.ActiveCfg = Release|Any CPU + {FD86C676-3D80-4971-8D8C-B0729B2251F6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -337,6 +463,15 @@ Global {24B0C12F-38CD-4245-8785-87BEFAD55B00} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} {C1774117-5073-4DF8-B5BE-BF7B538BD1C2} = {026FBC6C-AF76-4568-9B87-EC73457899FD} {80E322F5-5F5D-4670-A30F-02D33C2C7900} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} + {71287D6F-6C3B-44B4-9FCA-E78FE3F02289} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF} + {B693DE14-BB28-496F-AB39-B4E674ABCA80} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} + {5ADAA902-5A75-4ECB-B4B4-03291D63CE9C} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF} + {7FC5DFA3-6F66-4FD8-820D-81E93856F252} = {026FBC6C-AF76-4568-9B87-EC73457899FD} + {77F98215-3085-422E-B99D-4C404C2114CF} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} + {3BA4F9B9-3D90-44B5-B09C-28D98E0B4225} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} + {617FCA5D-A2DE-4083-B373-ADCA9901059F} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF} + {39DEAFE8-AE29-48E5-A67D-73776D70FC82} = {026FBC6C-AF76-4568-9B87-EC73457899FD} + {FD86C676-3D80-4971-8D8C-B0729B2251F6} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A2421882-8F0A-4905-928F-B550B192F9A4} diff --git a/JsonApiDotNetCore.sln.DotSettings b/JsonApiDotNetCore.sln.DotSettings index 0d088ac740..6c29a58aef 100644 --- a/JsonApiDotNetCore.sln.DotSettings +++ b/JsonApiDotNetCore.sln.DotSettings @@ -3,7 +3,10 @@ 2000 3000 False + True 83FF097C-C8C6-477B-9FAB-DF99B84978B5/f:ReadOnlySet.cs + swagger.g.json + swagger.json SOLUTION True True @@ -661,6 +664,7 @@ $left$ = $right$; True True True + True True True True diff --git a/README.md b/README.md index f73d1d85d6..d01f0b2dc7 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,6 @@ See also our [versioning policy](./VERSIONING_POLICY.md). | | | 9 | 9 | | master | Preview | 8 | 8, 9 | | | | 9 | 9 | -| openapi | Experimental | 8 | 8, 9 | -| | | 9 | 9 | ## Contributing diff --git a/docs/docfx.json b/docs/docfx.json index da0c58cac8..232d8768eb 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -23,6 +23,7 @@ "files": [ "api/**.yml", "api/index.md", + "ext/openapi/index.md", "getting-started/**.md", "getting-started/**/toc.yml", "usage/**.md", diff --git a/docs/ext/openapi/index.md b/docs/ext/openapi/index.md new file mode 100644 index 0000000000..20aad7b305 --- /dev/null +++ b/docs/ext/openapi/index.md @@ -0,0 +1,127 @@ +# JSON:API Extension for OpenAPI + +This extension facilitates using OpenAPI client generators targeting JSON:API documents. + +In JSON:API, a resource object contains the `type` member, which defines the structure of nested [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects. +While OpenAPI supports such constraints using `allOf` inheritance with a discriminator property for the `data` member, +it provides no way to express that the discriminator recursively applies to nested objects. + +This extension addresses that limitation by defining additional discriminator properties to guide code generation tools. + +## URI + +This extension has the URI `https://www.jsonapi.net/ext/openapi`. +Because code generators often choke on the double quotes in `Accept` and `Content-Type` HTTP header values, a relaxed form is also permitted: `openapi`. + +For example, the following `Content-Type` header: + +```http +Content-Type: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi" +``` + +is equivalent to: + +```http +Content-Type: application/vnd.api+json; ext=openapi +``` + +To avoid the need for double quotes when multiple extensions are used, the following relaxed form can be used: + +```http +Content-Type: application/vnd.api+json; ext=openapi; ext=atomic +``` + +> [!NOTE] +> The [base specification](https://jsonapi.org/format/#media-type-parameter-rules) *forbids* the use of multiple `ext` parameters +> and *requires* that each extension name must be a URI. +> This extension relaxes both constraints for practical reasons, to workaround bugs in client generators that produce broken code otherwise. + +## Namespace + +This extension uses the namespace `openapi`. + +> [!NOTE] +> JSON:API extensions can only introduce new document members using a reserved namespace as a prefix. + +## Document Structure + +A document that supports this extension MAY include any of the top-level members allowed by the base specification, +including any members defined in the [Atomic Operations extension](https://jsonapi.org/ext/atomic/). + +### Resource Objects + +In addition to the members allowed by the base specification, the following member MAY be included +in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects: + +* `openapi:discriminator` - A string that MUST be identical to the `type` member in the containing [resource object](https://jsonapi.org/format/#document-resource-objects). + +Here's how an article (i.e. a resource of type "articles") might appear in a document: + +```json +{ + "data": { + "type": "articles", + "id": "1", + "attributes": { + "openapi:discriminator": "articles", + "title": "Rails is Omakase" + }, + "relationships": { + "openapi:discriminator": "articles", + "author": { + "data": { "type": "people", "id": "9" } + } + } + } +} +``` + +### Atomic Operations + +In addition to the members allowed by the [Atomic Operations extension](https://jsonapi.org/ext/atomic/), +the following member MAY be included in elements of an `atomic:operations` array: + +* `openapi:discriminator` - A free-format string to facilitate generation of client code. + +For example: + +```http +POST /operations HTTP/1.1 +Host: example.org +Content-Type: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi https://jsonapi.org/ext/atomic" +Accept: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi https://jsonapi.org/ext/atomic" + +{ + "atomic:operations": [{ + "openapi:discriminator": "add-article", + "op": "add", + "data": { + "type": "articles", + "attributes": { + "openapi:discriminator": "articles", + "title": "JSON API paints my bikeshed!" + } + } + }] +} +``` + +## Processing + +A server MAY ignore the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects from incoming requests. +A server SHOULD ignore the `openapi:discriminator` member in elements of an `atomic:operations` array. + +A server MUST include the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects in outgoing responses. +The member value MUST be the same as the `type` member value of the containing resource object. + +A client MAY include the `openapi:discriminator` member in [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects in outgoing requests. +The member value MUST be the same as the `type` member value of the containing resource object. + +A client MAY include the `openapi:discriminator` member in elements of an `atomic:operations` array. + +### Processing Errors + +A server SHOULD validate that the value of the `openapi:discriminator` member in +[attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects +is identical to the `type` member in the containing resource object. When validation fails, the server MUST respond with a `409 Conflict` +and SHOULD include a document with a top-level `errors` member that contains an error object. diff --git a/docs/usage/openapi-client.md b/docs/usage/openapi-client.md new file mode 100644 index 0000000000..1c449aa981 --- /dev/null +++ b/docs/usage/openapi-client.md @@ -0,0 +1,356 @@ +> [!WARNING] +> OpenAPI support for JSON:API is currently experimental. The API and the structure of the OpenAPI document may change in future versions. + +# OpenAPI clients + +After [enabling OpenAPI](~/usage/openapi.md), you can generate a typed JSON:API client for your API in various programming languages. + +> [!NOTE] +> If you prefer a generic JSON:API client instead of a typed one, choose from the existing +> [client libraries](https://jsonapi.org/implementations/#client-libraries). + +The following code generators are supported, though you may try others as well: +- [NSwag](https://github.com/RicoSuter/NSwag) (v14.1 or higher): Produces clients for C# (requires `Newtonsoft.Json`) and TypeScript +- [Kiota](https://learn.microsoft.com/en-us/openapi/kiota/overview): Produces clients for C#, Go, Java, PHP, Python, Ruby, Swift and TypeScript + +# [NSwag](#tab/nswag) + +For C# clients, we provide an additional package that provides workarounds for bugs in NSwag and enables using partial POST/PATCH requests. + +To add it to your project, run the following command: +``` +dotnet add package JsonApiDotNetCore.OpenApi.Client.NSwag +``` + +# [Kiota](#tab/kiota) + +For C# clients, we provide an additional package that provides workarounds for bugs in Kiota, as well as MSBuild integration. + +To add it to your project, run the following command: +``` +dotnet add package JsonApiDotNetCore.OpenApi.Client.Kiota +``` + +--- + +## Getting started + +To generate your C# client, follow the steps below. + +# [NSwag](#tab/nswag) + +### Visual Studio + +The easiest way to get started is by using the built-in capabilities of Visual Studio. +The following steps describe how to generate and use a JSON:API client in C#, combined with our NuGet package. + +1. In **Solution Explorer**, right-click your client project, select **Add** > **Service Reference** and choose **OpenAPI**. + +1. On the next page, specify the OpenAPI URL to your JSON:API server, for example: `http://localhost:14140/swagger/v1/swagger.json`. + Specify `ExampleApiClient` as the class name, optionally provide a namespace and click **Finish**. + Visual Studio now downloads your swagger.json and updates your project file. + This adds a pre-build step that generates the client code. + + > [!TIP] + > To later re-download swagger.json and regenerate the client code, + > right-click **Dependencies** > **Manage Connected Services** and click the **Refresh** icon. + +1. Run package update now, which fixes incompatibilities and bugs from older versions. + +1. Add our client package to your project: + + ``` + dotnet add package JsonApiDotNetCore.OpenApi.Client.NSwag + ``` + +1. Add code that calls one of your JSON:API endpoints. + + ```c# + using var httpClient = new HttpClient(); + var apiClient = new ExampleApiClient(httpClient); + + var getResponse = await apiClient.GetPersonCollectionAsync(new Dictionary + { + ["filter"] = "has(assignedTodoItems)", + ["sort"] = "-lastName", + ["page[size]"] = "5" + }); + + foreach (var person in getResponse.Data) + { + Console.WriteLine($"Found person {person.Id}: {person.Attributes!.DisplayName}"); + } + ``` + +1. Extend the demo code to send a partial PATCH request with the help of our package: + + ```c# + var updatePersonRequest = new UpdatePersonRequestDocument + { + Data = new DataInUpdatePersonRequest + { + Id = "1", + // Using TrackChangesFor to send "firstName: null" instead of omitting it. + Attributes = new TrackChangesFor(_apiClient) + { + Initializer = + { + FirstName = null, + LastName = "Doe" + } + }.Initializer + } + }; + + await ApiResponse.TranslateAsync(async () => + await _apiClient.PatchPersonAsync(updatePersonRequest.Data.Id, updatePersonRequest)); + + // The sent request looks like this: + // { + // "data": { + // "type": "people", + // "id": "1", + // "attributes": { + // "firstName": null, + // "lastName": "Doe" + // } + // } + // } + ``` + +> [!TIP] +> The [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiNSwagClientExample) contains an enhanced version +> that uses `IHttpClientFactory` for [scalability](https://learn.microsoft.com/en-us/dotnet/core/extensions/httpclient-factory) and +> [resiliency](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests#use-polly-based-handlers) and logs the HTTP requests and responses. +> Additionally, the example shows how to write the swagger.json file to disk when building the server, which is imported from the client project. +> This keeps the server and client automatically in sync, which is handy when both are in the same solution. + +### Other IDEs + +The following section shows what to add to your client project file directly: + +```xml + + + + + + + + + http://localhost:14140/swagger/v1/swagger.json + ExampleApiClient + %(ClassName).cs + + +``` + +From here, continue from step 3 in the list of steps for Visual Studio. + +# [Kiota](#tab/kiota) + +To generate your C# client, first add the Kiota tool to your solution: + +``` +dotnet tool install microsoft.openapi.kiota +``` + +After adding the `JsonApiDotNetCore.OpenApi.Client.Kiota` package to your project, add a `KiotaReference` element +to your project file to import your OpenAPI file. For example: + +```xml + + + + $(MSBuildProjectName).GeneratedCode + ExampleApiClient + ./GeneratedCode + $(JsonApiExtraArguments) + + + +``` + +> [!NOTE] +> The `ExtraArguments` parameter is required for compatibility with JSON:API. + +Next, build your project. It runs the kiota command-line tool, which generates files in the `GeneratedCode` subdirectory. + +> [!CAUTION] +> If you're not using ``, at least make sure you're passing the `--backing-store` switch to the command-line tool, +> which is needed for JSON:API partial POST/PATCH requests to work correctly. + +Kiota is pretty young and therefore still rough around the edges. At the time of writing, there are various bugs, for which we have workarounds +in place. For a full example, see the [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiKiotaClientExample). + +--- + +## Configuration + +Various switches enable you to tweak the client generation to your needs. See the section below for an overview. + +# [NSwag](#tab/nswag) + +The `OpenApiReference` element can be customized using various [NSwag-specific MSBuild properties](https://github.com/RicoSuter/NSwag/blob/7d6df3af95081f3f0ed6dee04be8d27faa86f91a/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.props). +See [the source code](https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Commands/Commands/CodeGeneration/OpenApiToCSharpClientCommand.cs) for their meaning. +The `JsonApiDotNetCore.OpenApi.Client.NSwag` package sets various of these for optimal JSON:API support. + +> [!NOTE] +> Earlier versions of NSwag required the use of `` to specify command-line switches directly. +> This is no longer recommended and may conflict with the new MSBuild properties. + +For example, the following section puts the generated code in a namespace, makes the client class internal and generates an interface (handy when writing tests): + +```xml + + ExampleProject.GeneratedCode + internal + true + +``` + +# [Kiota](#tab/kiota) + +The available command-line switches for Kiota are described [here](https://learn.microsoft.com/en-us/openapi/kiota/using#client-generation). + +At the time of writing, Kiota provides [no official integration](https://github.com/microsoft/kiota/issues/3005) with MSBuild. +Our [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiKiotaClientExample) takes a stab at it, +which seems to work. If you're an MSBuild expert, please help out! + +```xml + + + + + + + + + + + + + + + +``` + +--- + +## Headers and caching + +The use of HTTP headers varies per client generator. To use [ETags for caching](~/usage/caching.md), see the notes below. + +# [NSwag](#tab/nswag) + +To gain access to HTTP response headers, add the following in a `PropertyGroup` or directly in the `OpenApiReference`: + +``` +true +``` + +This enables the following code, which is explained below: + +```c# +var getResponse = await ApiResponse.TranslateAsync(() => apiClient.GetPersonCollectionAsync()); +string eTag = getResponse.Headers["ETag"].Single(); +Console.WriteLine($"Retrieved {getResponse.Result?.Data.Count ?? 0} people."); + +// wait some time... + +getResponse = await ApiResponse.TranslateAsync(() => apiClient.GetPersonCollectionAsync(if_None_Match: eTag)); + +if (getResponse is { StatusCode: (int)HttpStatusCode.NotModified, Result: null }) +{ + Console.WriteLine("The HTTP response hasn't changed, so no response body was returned."); +} +``` + +The response of the first API call contains both data and an ETag header, which is a fingerprint of the response. +That ETag gets passed to the second API call. This enables the server to detect if something changed, which optimizes +network usage: no data is sent back, unless is has changed. +If you only want to ask whether data has changed without fetching it, use a HEAD request instead. + +# [Kiota](#tab/kiota) + +Use `HeadersInspectionHandlerOption` to gain access to HTTP response headers. For example: + +```c# +var headerInspector = new HeadersInspectionHandlerOption +{ + InspectResponseHeaders = true +}; + +var responseDocument = await apiClient.Api.People.GetAsync(configuration => configuration.Options.Add(headerInspector)); + +string eTag = headerInspector.ResponseHeaders["ETag"].Single(); +``` + +Due to a [bug in Kiota](https://github.com/microsoft/kiota/issues/4190), a try/catch block is needed additionally to make this work. + +For a full example, see the [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiKiotaClientExample). + +--- + +## Atomic operations + +# [NSwag](#tab/nswag) + +[Atomic operations](~/usage/writing/bulk-batch-operations.md) are fully supported. +The [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiNSwagClientExample) +demonstrates how to use them. It uses local IDs to: +- Create a new tag +- Create a new person +- Update the person to clear an attribute (using `TrackChangesFor`) +- Create a new todo-item, tagged with the new tag, and owned by the new person +- Assign the todo-item to the created person + +# [Kiota](#tab/kiota) + +[Atomic operations](~/usage/writing/bulk-batch-operations.md) are fully supported. +See the [example project](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/OpenApiKiotaClientExample) +demonstrates how to use them. It uses local IDs to: +- Create a new tag +- Create a new person +- Update the person to clear an attribute (using built-in backing-store) +- Create a new todo-item, tagged with the new tag, and owned by the new person +- Assign the todo-item to the created person + +--- + +## Known limitations + +# [NSwag](#tab/nswag) + +| Limitation | Workaround | Links | +| --- | --- | --- | +| Partial POST/PATCH sends incorrect request | Use `TrackChangesFor` from `JsonApiDotNetCore.OpenApi.Client.NSwag` package | | +| Exception thrown on successful HTTP status | Use `TranslateAsync` from `JsonApiDotNetCore.OpenApi.Client.NSwag` package | https://github.com/RicoSuter/NSwag/issues/2499 | +| No `Accept` header sent when only error responses define `Content-Type` | `JsonApiDotNetCore.OpenApi.Swashbuckle` package contains workaround | | +| Schema type not always inferred with `allOf` | `JsonApiDotNetCore.OpenApi.Swashbuckle` package contains workaround | | +| Generated code for JSON:API extensions does not compile | `JsonApiDotNetCore.OpenApi.Swashbuckle` package contains workaround | | +| A project can't contain both JSON:API clients and regular OpenAPI clients | Use separate projects | | + +# [Kiota](#tab/kiota) + +| Limitation | Workaround | Links | +| --- | --- | --- | +| Properties are always nullable | - | https://github.com/microsoft/kiota/issues/3911 | +| JSON:API query strings are inaccessible | Use `SetQueryStringHttpMessageHandler.CreateScope` from `JsonApiDotNetCore.OpenApi.Client.Kiota` package | https://github.com/microsoft/kiota/issues/3800 | +| Properties set to `null` are sent twice | - | https://github.com/microsoft/kiota-dotnet/issues/535 | +| HTTP 304 (Not Modified) is not properly recognized | Catch `ApiException` and inspect the response status code | https://github.com/microsoft/kiota/issues/4190, https://github.com/microsoft/kiota-dotnet/issues/531 | +| Generator warns about unsupported formats | Use `JsonApiDotNetCore.OpenApi.Client.Kiota` package | https://github.com/microsoft/kiota/issues/4227 | +| `Stream` response for HEAD request | - | https://github.com/microsoft/kiota/issues/4245 | +| Unhelpful exception messages | - | https://github.com/microsoft/kiota/issues/4349 | +| Discriminator properties aren't being set automatically | - | https://github.com/microsoft/kiota/issues/4618 | +| Discriminator mappings must be repeated in every derived type used in responses | `JsonApiDotNetCore.OpenApi.Swashbuckle` package contains workaround | https://github.com/microsoft/kiota/issues/2432 | +| `x-abstract` in `openapi.json` is ignored | - | | +| No MSBuild / IDE support | Use `KiotaReference` from `JsonApiDotNetCore.OpenApi.Client.Kiota` package | https://github.com/microsoft/kiota/issues/3005 | +| Incorrect nullability in API methods | Use `KiotaReference` from `JsonApiDotNetCore.OpenApi.Client.Kiota` package | https://github.com/microsoft/kiota/issues/3944 | +| Generated code for JSON:API extensions does not compile | `JsonApiDotNetCore.OpenApi.Swashbuckle` package contains workaround | | +| Properties are always sent in alphabetic order | - | https://github.com/microsoft/kiota/issues/4680 | + +--- diff --git a/docs/usage/openapi-documentation.md b/docs/usage/openapi-documentation.md new file mode 100644 index 0000000000..6737bd6404 --- /dev/null +++ b/docs/usage/openapi-documentation.md @@ -0,0 +1,48 @@ +> [!WARNING] +> OpenAPI support for JSON:API is currently experimental. The API and the structure of the OpenAPI document may change in future versions. + +# OpenAPI documentation + +After [enabling OpenAPI](~/usage/openapi.md), you can expose a documentation website with SwaggerUI, Redoc and/or Scalar. + +## SwaggerUI + +[SwaggerUI](https://swagger.io/tools/swagger-ui/) enables to visualize and interact with the JSON:API endpoints through a web page. +While it conveniently provides the ability to execute requests, it doesn't show properties of derived types when component schema inheritance is used. + +SwaggerUI can be enabled by installing the `Swashbuckle.AspNetCore.SwaggerUI` NuGet package and adding the following to your `Program.cs` file: + +```c# +app.UseSwaggerUI(); +``` + +Then run your app and open `/swagger` in your browser. + +## Redoc + +[Redoc](https://github.com/Redocly/redoc) is another popular tool that generates a documentation website from an OpenAPI document. +It lists the endpoints and their schemas, but doesn't provide the ability to execute requests. +However, this tool most accurately reflects properties when component schema inheritance is used; choosing a different "type" from the +dropdown box dynamically adapts the list of schema properties. + +The `Swashbuckle.AspNetCore.ReDoc` NuGet package provides integration with Swashbuckle. +After installing the package, add the following to your `Program.cs` file: + +```c# +app.UseReDoc(); +``` + +Next, run your app and navigate to `/api-docs` to view the documentation. + +## Scalar + +[Scalar](https://scalar.com/) is a modern documentation website generator, which includes the ability to execute requests. +It shows component schemas in a low-level way (not collapsing `allOf` nodes), but does a poor job in handling component schema inheritance. + +After installing the `Scalar.AspNetCore` NuGet package, add the following to your `Program.cs` to make it use the OpenAPI document produced by Swashbuckle: + +```c# +app.MapScalarApiReference(options => options.OpenApiRoutePattern = "/swagger/{documentName}/swagger.json"); +``` + +Then run your app and navigate to `/scalar/v1` to view the documentation. diff --git a/docs/usage/openapi.md b/docs/usage/openapi.md new file mode 100644 index 0000000000..e49f120a14 --- /dev/null +++ b/docs/usage/openapi.md @@ -0,0 +1,87 @@ +> [!WARNING] +> OpenAPI support for JSON:API is currently experimental. The API and the structure of the OpenAPI document may change in future versions. + +# OpenAPI + +Exposing an [OpenAPI document](https://swagger.io/specification/) for your JSON:API endpoints enables to provide a +[documentation website](https://swagger.io/tools/swagger-ui/) and to generate typed +[client libraries](https://openapi-generator.tech/docs/generators/) in various languages. + +The [JsonApiDotNetCore.OpenApi.Swashbuckle](https://github.com/json-api-dotnet/JsonApiDotNetCore/pkgs/nuget/JsonApiDotNetCore.OpenApi.Swashbuckle) NuGet package +provides OpenAPI support for JSON:API by integrating with [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore). + +## Getting started + +1. Install the `JsonApiDotNetCore.OpenApi.Swashbuckle` NuGet package: + + ``` + dotnet add package JsonApiDotNetCore.OpenApi.Swashbuckle + ``` + + > [!NOTE] + > Because this package is still experimental, it's not yet available on NuGet. + > Use the steps [here](https://github.com/json-api-dotnet/JsonApiDotNetCore?tab=readme-ov-file#trying-out-the-latest-build) to install. + +2. Add the JSON:API support to your `Program.cs` file. + + ```c# + builder.Services.AddJsonApi(); + + // Configure Swashbuckle for JSON:API. + builder.Services.AddOpenApiForJsonApi(); + + var app = builder.Build(); + + app.UseRouting(); + app.UseJsonApi(); + + // Add the Swashbuckle middleware. + app.UseSwagger(); + ``` + +By default, the OpenAPI document will be available at `http://localhost:/swagger/v1/swagger.json`. + +### Customizing the Route Template + +Because Swashbuckle doesn't properly implement the ASP.NET Options pattern, you must *not* use its +[documented way](https://github.com/domaindrivendev/Swashbuckle.AspNetCore?tab=readme-ov-file#change-the-path-for-swagger-json-endpoints) +to change the route template: + +```c# +// DO NOT USE THIS! INCOMPATIBLE WITH JSON:API! +app.UseSwagger(options => options.RouteTemplate = "api-docs/{documentName}/swagger.yaml"); +``` + +Instead, always call `UseSwagger()` *without parameters*. To change the route template, use the code below: + +```c# +builder.Services.Configure(options => options.RouteTemplate = "/api-docs/{documentName}/swagger.yaml"); +``` + +If you want to inject dependencies to set the route template, use: + +```c# +builder.Services.AddOptions().Configure((options, serviceProvider) => +{ + var webHostEnvironment = serviceProvider.GetRequiredService(); + string appName = webHostEnvironment.ApplicationName; + options.RouteTemplate = $"/api-docs/{{documentName}}/{appName}-swagger.yaml"; +}); +``` + +## Triple-slash comments + +Documentation for JSON:API endpoints is provided out of the box, which shows in SwaggerUI and through IDE IntelliSense in auto-generated clients. +To also get documentation for your resource classes and their properties, add the following to your project file. +The `NoWarn` line is optional, which suppresses build warnings for undocumented types and members. + +```xml + + True + $(NoWarn);1591 + +``` + +You can combine this with the documentation that Swagger itself supports, by enabling it as described +[here](https://github.com/domaindrivendev/Swashbuckle.AspNetCore#include-descriptions-from-xml-comments). +This adds documentation for additional types, such as triple-slash comments on enums used in your resource models. diff --git a/docs/usage/toc.md b/docs/usage/toc.md index 61d3da8de0..bdeb0e4958 100644 --- a/docs/usage/toc.md +++ b/docs/usage/toc.md @@ -25,6 +25,10 @@ # [Caching](caching.md) # [Common Pitfalls](common-pitfalls.md) +# [OpenAPI](openapi.md) +## [Documentation](openapi-documentation.md) +## [Clients](openapi-client.md) + # Extensibility ## [Layer Overview](extensibility/layer-overview.md) ## [Resource Definitions](extensibility/resource-definitions.md) diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000000..16164967c6 --- /dev/null +++ b/nuget.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/package-versions.props b/package-versions.props index e7c32c98fa..8b528ff324 100644 --- a/package-versions.props +++ b/package-versions.props @@ -4,18 +4,28 @@ 4.1.0 0.4.1 2.14.1 + 8.0.0 + 13.0.3 0.14.* + 1.0.* 35.6.* - 4.12.* + 4.13.* 6.0.* 2.1.* 7.2.* 2.4.* 2.0.* + 1.* + 9.0.* + 9.0.* + 14.3.* + 13.0.* + 2.1.* + 8.*-* 9.0.* - 17.12.* + 17.13.* 2.9.* 2.8.* diff --git a/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json new file mode 100644 index 0000000000..4863000598 --- /dev/null +++ b/src/Examples/JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json @@ -0,0 +1,8583 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "JsonApiDotNetCoreExample", + "version": "1.0" + }, + "servers": [ + { + "url": "https://localhost:44340" + } + ], + "paths": { + "/api/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/people": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves a collection of people.", + "operationId": "getPersonCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found people, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/personCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves a collection of people without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPersonCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "people" + ], + "summary": "Creates a new person.", + "operationId": "postPerson", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the person to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createPersonRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The person was successfully created, which resulted in additional changes. The newly created person is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created person can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryPersonResponseDocument" + } + } + } + }, + "204": { + "description": "The person was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/people/{id}": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves an individual person by its identifier.", + "operationId": "getPerson", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found person.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryPersonResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves an individual person by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPerson", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The person does not exist." + } + } + }, + "patch": { + "tags": [ + "people" + ], + "summary": "Updates an existing person.", + "operationId": "patchPerson", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the person to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updatePersonRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The person was successfully updated, which resulted in additional changes. The updated person is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryPersonResponseDocument" + } + } + } + }, + "204": { + "description": "The person was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "people" + ], + "summary": "Deletes an existing person by its identifier.", + "operationId": "deletePerson", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The person was successfully deleted." + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/people/{id}/assignedTodoItems": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItems of an individual person's assignedTodoItems relationship.", + "operationId": "getPersonAssignedTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItems, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItems of an individual person's assignedTodoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPersonAssignedTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The person does not exist." + } + } + } + }, + "/api/people/{id}/relationships/assignedTodoItems": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItem identities of an individual person's assignedTodoItems relationship.", + "operationId": "getPersonAssignedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItem identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItem identities of an individual person's assignedTodoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPersonAssignedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The person does not exist." + } + } + }, + "post": { + "tags": [ + "people" + ], + "summary": "Adds existing todoItems to the assignedTodoItems relationship of an individual person.", + "operationId": "postPersonAssignedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to add todoItems to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to add to the assignedTodoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "people" + ], + "summary": "Assigns existing todoItems to the assignedTodoItems relationship of an individual person.", + "operationId": "patchPersonAssignedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose assignedTodoItems relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to assign to the assignedTodoItems relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The assignedTodoItems relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "people" + ], + "summary": "Removes existing todoItems from the assignedTodoItems relationship of an individual person.", + "operationId": "deletePersonAssignedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to remove todoItems from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to remove from the assignedTodoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/people/{id}/ownedTodoItems": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItems of an individual person's ownedTodoItems relationship.", + "operationId": "getPersonOwnedTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItems, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItems of an individual person's ownedTodoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPersonOwnedTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The person does not exist." + } + } + } + }, + "/api/people/{id}/relationships/ownedTodoItems": { + "get": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItem identities of an individual person's ownedTodoItems relationship.", + "operationId": "getPersonOwnedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItem identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "people" + ], + "summary": "Retrieves the related todoItem identities of an individual person's ownedTodoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headPersonOwnedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The person does not exist." + } + } + }, + "post": { + "tags": [ + "people" + ], + "summary": "Adds existing todoItems to the ownedTodoItems relationship of an individual person.", + "operationId": "postPersonOwnedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to add todoItems to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to add to the ownedTodoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "people" + ], + "summary": "Assigns existing todoItems to the ownedTodoItems relationship of an individual person.", + "operationId": "patchPersonOwnedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person whose ownedTodoItems relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to assign to the ownedTodoItems relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The ownedTodoItems relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "people" + ], + "summary": "Removes existing todoItems from the ownedTodoItems relationship of an individual person.", + "operationId": "deletePersonOwnedTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the person to remove todoItems from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to remove from the ownedTodoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The person or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/tags": { + "get": { + "tags": [ + "tags" + ], + "summary": "Retrieves a collection of tags.", + "operationId": "getTagCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found tags, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/tagCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "tags" + ], + "summary": "Retrieves a collection of tags without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTagCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "tags" + ], + "summary": "Creates a new tag.", + "operationId": "postTag", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the tag to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createTagRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The tag was successfully created, which resulted in additional changes. The newly created tag is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created tag can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTagResponseDocument" + } + } + } + }, + "204": { + "description": "The tag was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/tags/{id}": { + "get": { + "tags": [ + "tags" + ], + "summary": "Retrieves an individual tag by its identifier.", + "operationId": "getTag", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found tag.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTagResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "tags" + ], + "summary": "Retrieves an individual tag by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTag", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The tag does not exist." + } + } + }, + "patch": { + "tags": [ + "tags" + ], + "summary": "Updates an existing tag.", + "operationId": "patchTag", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the tag to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateTagRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The tag was successfully updated, which resulted in additional changes. The updated tag is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTagResponseDocument" + } + } + } + }, + "204": { + "description": "The tag was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "tags" + ], + "summary": "Deletes an existing tag by its identifier.", + "operationId": "deleteTag", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The tag was successfully deleted." + }, + "404": { + "description": "The tag does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/tags/{id}/todoItems": { + "get": { + "tags": [ + "tags" + ], + "summary": "Retrieves the related todoItems of an individual tag's todoItems relationship.", + "operationId": "getTagTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItems, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "tags" + ], + "summary": "Retrieves the related todoItems of an individual tag's todoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTagTodoItems", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag whose related todoItems to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The tag does not exist." + } + } + } + }, + "/api/tags/{id}/relationships/todoItems": { + "get": { + "tags": [ + "tags" + ], + "summary": "Retrieves the related todoItem identities of an individual tag's todoItems relationship.", + "operationId": "getTagTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItem identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "tags" + ], + "summary": "Retrieves the related todoItem identities of an individual tag's todoItems relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTagTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag whose related todoItem identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The tag does not exist." + } + } + }, + "post": { + "tags": [ + "tags" + ], + "summary": "Adds existing todoItems to the todoItems relationship of an individual tag.", + "operationId": "postTagTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to add todoItems to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to add to the todoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "tags" + ], + "summary": "Assigns existing todoItems to the todoItems relationship of an individual tag.", + "operationId": "patchTagTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag whose todoItems relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to assign to the todoItems relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "tags" + ], + "summary": "Removes existing todoItems from the todoItems relationship of an individual tag.", + "operationId": "deleteTagTodoItemsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the tag to remove todoItems from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the todoItems to remove from the todoItems relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The todoItems were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The tag or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/todoItems": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves a collection of todoItems.", + "operationId": "getTodoItemCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItems, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/todoItemCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves a collection of todoItems without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "todoItems" + ], + "summary": "Creates a new todoItem.", + "operationId": "postTodoItem", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the todoItem to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createTodoItemRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The todoItem was successfully created, which resulted in additional changes. The newly created todoItem is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created todoItem can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" + } + } + } + }, + "204": { + "description": "The todoItem was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/todoItems/{id}": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves an individual todoItem by its identifier.", + "operationId": "getTodoItem", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found todoItem.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves an individual todoItem by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItem", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + }, + "patch": { + "tags": [ + "todoItems" + ], + "summary": "Updates an existing todoItem.", + "operationId": "patchTodoItem", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the todoItem to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateTodoItemRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The todoItem was successfully updated, which resulted in additional changes. The updated todoItem is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTodoItemResponseDocument" + } + } + } + }, + "204": { + "description": "The todoItem was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "todoItems" + ], + "summary": "Deletes an existing todoItem by its identifier.", + "operationId": "deleteTodoItem", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The todoItem was successfully deleted." + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/todoItems/{id}/assignee": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person of an individual todoItem's assignee relationship.", + "operationId": "getTodoItemAssignee", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found person, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryPersonResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person of an individual todoItem's assignee relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemAssignee", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + } + }, + "/api/todoItems/{id}/relationships/assignee": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person identity of an individual todoItem's assignee relationship.", + "operationId": "getTodoItemAssigneeRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found person identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullablePersonIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person identity of an individual todoItem's assignee relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemAssigneeRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + }, + "patch": { + "tags": [ + "todoItems" + ], + "summary": "Clears or assigns an existing person to the assignee relationship of an individual todoItem.", + "operationId": "patchTodoItemAssigneeRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose assignee relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the person to assign to the assignee relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The assignee relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/todoItems/{id}/owner": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person of an individual todoItem's owner relationship.", + "operationId": "getTodoItemOwner", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found person, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryPersonResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person of an individual todoItem's owner relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemOwner", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + } + }, + "/api/todoItems/{id}/relationships/owner": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person identity of an individual todoItem's owner relationship.", + "operationId": "getTodoItemOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found person identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/personIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related person identity of an individual todoItem's owner relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related person identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + }, + "patch": { + "tags": [ + "todoItems" + ], + "summary": "Assigns an existing person to the owner relationship of an individual todoItem.", + "operationId": "patchTodoItemOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose owner relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the person to assign to the owner relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The owner relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/api/todoItems/{id}/tags": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related tags of an individual todoItem's tags relationship.", + "operationId": "getTodoItemTags", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related tags to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found tags, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/tagCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related tags of an individual todoItem's tags relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemTags", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related tags to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + } + }, + "/api/todoItems/{id}/relationships/tags": { + "get": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related tag identities of an individual todoItem's tags relationship.", + "operationId": "getTodoItemTagsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related tag identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found tag identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/tagIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "todoItems" + ], + "summary": "Retrieves the related tag identities of an individual todoItem's tags relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTodoItemTagsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose related tag identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The todoItem does not exist." + } + } + }, + "post": { + "tags": [ + "todoItems" + ], + "summary": "Adds existing tags to the tags relationship of an individual todoItem.", + "operationId": "postTodoItemTagsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to add tags to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the tags to add to the tags relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The tags were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "todoItems" + ], + "summary": "Assigns existing tags to the tags relationship of an individual todoItem.", + "operationId": "patchTodoItemTagsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem whose tags relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the tags to assign to the tags relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The tags relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "todoItems" + ], + "summary": "Removes existing tags from the tags relationship of an individual todoItem.", + "operationId": "deleteTodoItemTagsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the todoItem to remove tags from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the tags to remove from the tags relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The tags were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The todoItem or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToPersonAssignedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personAssignedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToPersonOwnedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personOwnedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToTagTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/tagTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToTodoItemTagsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemTagsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addPerson": "#/components/schemas/createPersonOperation", + "addTag": "#/components/schemas/createTagOperation", + "addToPersonAssignedTodoItems": "#/components/schemas/addToPersonAssignedTodoItemsRelationshipOperation", + "addToPersonOwnedTodoItems": "#/components/schemas/addToPersonOwnedTodoItemsRelationshipOperation", + "addToTagTodoItems": "#/components/schemas/addToTagTodoItemsRelationshipOperation", + "addToTodoItemTags": "#/components/schemas/addToTodoItemTagsRelationshipOperation", + "addTodoItem": "#/components/schemas/createTodoItemOperation", + "removeFromPersonAssignedTodoItems": "#/components/schemas/removeFromPersonAssignedTodoItemsRelationshipOperation", + "removeFromPersonOwnedTodoItems": "#/components/schemas/removeFromPersonOwnedTodoItemsRelationshipOperation", + "removeFromTagTodoItems": "#/components/schemas/removeFromTagTodoItemsRelationshipOperation", + "removeFromTodoItemTags": "#/components/schemas/removeFromTodoItemTagsRelationshipOperation", + "removePerson": "#/components/schemas/deletePersonOperation", + "removeTag": "#/components/schemas/deleteTagOperation", + "removeTodoItem": "#/components/schemas/deleteTodoItemOperation", + "updatePerson": "#/components/schemas/updatePersonOperation", + "updatePersonAssignedTodoItems": "#/components/schemas/updatePersonAssignedTodoItemsRelationshipOperation", + "updatePersonOwnedTodoItems": "#/components/schemas/updatePersonOwnedTodoItemsRelationshipOperation", + "updateTag": "#/components/schemas/updateTagOperation", + "updateTagTodoItems": "#/components/schemas/updateTagTodoItemsRelationshipOperation", + "updateTodoItem": "#/components/schemas/updateTodoItemOperation", + "updateTodoItemAssignee": "#/components/schemas/updateTodoItemAssigneeRelationshipOperation", + "updateTodoItemOwner": "#/components/schemas/updateTodoItemOwnerRelationshipOperation", + "updateTodoItemTags": "#/components/schemas/updateTodoItemTagsRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInCreatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "lastName" + ], + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInCreatePersonRequest", + "tags": "#/components/schemas/attributesInCreateTagRequest", + "todoItems": "#/components/schemas/attributesInCreateTodoItemRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "description", + "priority" + ], + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "displayName": { + "type": "string", + "readOnly": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInPersonResponse", + "tags": "#/components/schemas/attributesInTagResponse", + "todoItems": "#/components/schemas/attributesInTodoItemResponse" + } + }, + "x-abstract": true + }, + "attributesInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "modifiedAt": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "firstName": { + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/attributesInUpdatePersonRequest", + "tags": "#/components/schemas/attributesInUpdateTagRequest", + "todoItems": "#/components/schemas/attributesInUpdateTodoItemRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "priority": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemPriority" + } + ] + }, + "durationInHours": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createPersonOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreatePersonRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createPersonRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreatePersonRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createTagOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTagRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createTagRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTagRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createTodoItemOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTodoItemRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createTodoItemRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTodoItemRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreatePersonRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePersonRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePersonRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateTagRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTagRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTagRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateTodoItemRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTodoItemRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTodoItemRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPersonResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPersonResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTagResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTagResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTodoItemResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTodoItemResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdatePersonRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdatePersonRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdatePersonRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateTagRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTagRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTagRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateTodoItemRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTodoItemRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTodoItemRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deletePersonOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteTagOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteTodoItemOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/personIdentifierInRequest", + "tags": "#/components/schemas/tagIdentifierInRequest", + "todoItems": "#/components/schemas/todoItemIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullablePersonIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryPersonResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPersonResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOnePersonInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOnePersonInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "personAssignedTodoItemsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/personResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/personAssignedTodoItemsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "personAssignedTodoItemsRelationshipName": { + "enum": [ + "assignedTodoItems" + ], + "type": "string" + }, + "personCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInPersonResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "personIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "personIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/personResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "personIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "personOwnedTodoItemsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/personResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/personOwnedTodoItemsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "personOwnedTodoItemsRelationshipName": { + "enum": [ + "ownedTodoItems" + ], + "type": "string" + }, + "personResourceType": { + "enum": [ + "people" + ], + "type": "string" + }, + "primaryPersonResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPersonResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryTagResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInTagResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryTodoItemResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInTodoItemResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInCreatePersonRequest", + "tags": "#/components/schemas/relationshipsInCreateTagRequest", + "todoItems": "#/components/schemas/relationshipsInCreateTodoItemRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "owner" + ], + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInRequest" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInRequest" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInPersonResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInPersonResponse", + "tags": "#/components/schemas/relationshipsInTagResponse", + "todoItems": "#/components/schemas/relationshipsInTodoItemResponse" + } + }, + "x-abstract": true + }, + "relationshipsInTagResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInTodoItemResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInResponse" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInResponse" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdatePersonRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "ownedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + }, + "assignedTodoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "people": "#/components/schemas/relationshipsInUpdatePersonRequest", + "tags": "#/components/schemas/relationshipsInUpdateTagRequest", + "todoItems": "#/components/schemas/relationshipsInUpdateTodoItemRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateTagRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "todoItems": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTodoItemInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateTodoItemRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOnePersonInRequest" + } + ] + }, + "assignee": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOnePersonInRequest" + } + ] + }, + "tags": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTagInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromPersonAssignedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personAssignedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromPersonOwnedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personOwnedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromTagTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/tagTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromTodoItemTagsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemTagsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInCreatePersonRequest", + "tags": "#/components/schemas/dataInCreateTagRequest", + "todoItems": "#/components/schemas/dataInCreateTodoItemRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInPersonResponse", + "tags": "#/components/schemas/dataInTagResponse", + "todoItems": "#/components/schemas/dataInTodoItemResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "people": "#/components/schemas/dataInUpdatePersonRequest", + "tags": "#/components/schemas/dataInUpdateTagRequest", + "todoItems": "#/components/schemas/dataInUpdateTodoItemRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "people", + "tags", + "todoItems" + ], + "type": "string" + }, + "secondaryPersonResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPersonResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "tagCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInTagResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "tagIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "tagIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "tagIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/tagResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "tagResourceType": { + "enum": [ + "tags" + ], + "type": "string" + }, + "tagTodoItemsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/tagResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/tagTodoItemsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "tagTodoItemsRelationshipName": { + "enum": [ + "todoItems" + ], + "type": "string" + }, + "toManyTagInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyTagInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyTodoItemInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyTodoItemInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOnePersonInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOnePersonInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemAssigneeRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemAssigneeRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemAssigneeRelationshipName": { + "enum": [ + "assignee" + ], + "type": "string" + }, + "todoItemCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInTodoItemResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "todoItemIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemOwnerRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemOwnerRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemOwnerRelationshipName": { + "enum": [ + "owner" + ], + "type": "string" + }, + "todoItemPriority": { + "enum": [ + "High", + "Medium", + "Low" + ], + "type": "string" + }, + "todoItemResourceType": { + "enum": [ + "todoItems" + ], + "type": "string" + }, + "todoItemTagsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemTagsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "todoItemTagsRelationshipName": { + "enum": [ + "tags" + ], + "type": "string" + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updatePersonAssignedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personAssignedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updatePersonOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdatePersonRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updatePersonOwnedTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/personOwnedTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updatePersonRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdatePersonRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateTagOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTagRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTagRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTagRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateTagTodoItemsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/tagTodoItemsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTodoItemAssigneeRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemAssigneeRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTodoItemOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTodoItemRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTodoItemOwnerRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemOwnerRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/personIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTodoItemRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTodoItemRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateTodoItemTagsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/todoItemTagsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/tagIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj index 3edc993428..768a2de827 100644 --- a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj +++ b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj @@ -1,6 +1,8 @@ net9.0;net8.0 + true + GeneratedSwagger @@ -9,10 +11,15 @@ + + + + + diff --git a/src/Examples/JsonApiDotNetCoreExample/Program.cs b/src/Examples/JsonApiDotNetCoreExample/Program.cs index 2cfa1e640d..d2677ea781 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Program.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Program.cs @@ -3,17 +3,22 @@ using System.Text.Json.Serialization; using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Diagnostics; +using JsonApiDotNetCore.OpenApi.Swashbuckle; using JsonApiDotNetCoreExample; using JsonApiDotNetCoreExample.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.DependencyInjection.Extensions; +using Scalar.AspNetCore; [assembly: ExcludeFromCodeCoverage] WebApplication app = CreateWebApplication(args); -await CreateDatabaseAsync(app.Services); +if (!IsGeneratingOpenApiDocumentAtBuildTime()) +{ + await CreateDatabaseAsync(app.Services); +} await app.RunAsync(); @@ -71,6 +76,13 @@ static void ConfigureServices(WebApplicationBuilder builder) #endif }, discovery => discovery.AddCurrentAssembly()); } + + using (CodeTimingSessionManager.Current.Measure("AddOpenApiForJsonApi()")) + { +#pragma warning disable JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + builder.Services.AddOpenApiForJsonApi(options => options.DocumentFilter()); +#pragma warning restore JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + } } [Conditional("DEBUG")] @@ -92,9 +104,19 @@ static void ConfigurePipeline(WebApplication app) app.UseJsonApi(); } + app.UseSwagger(); + app.UseSwaggerUI(); + app.UseReDoc(); + app.MapScalarApiReference(options => options.OpenApiRoutePattern = "/swagger/{documentName}/swagger.json"); + app.MapControllers(); } +static bool IsGeneratingOpenApiDocumentAtBuildTime() +{ + return Environment.GetCommandLineArgs().Any(argument => argument.Contains("GetDocument.Insider")); +} + static async Task CreateDatabaseAsync(IServiceProvider serviceProvider) { await using AsyncServiceScope scope = serviceProvider.CreateAsyncScope(); diff --git a/src/Examples/JsonApiDotNetCoreExample/Properties/launchSettings.json b/src/Examples/JsonApiDotNetCoreExample/Properties/launchSettings.json index 54646922e1..82b89e1843 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Properties/launchSettings.json +++ b/src/Examples/JsonApiDotNetCoreExample/Properties/launchSettings.json @@ -12,7 +12,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "api/todoItems?include=owner,assignee,tags&filter=equals(priority,'High')", + "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -20,7 +20,7 @@ "Kestrel": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "api/todoItems?include=owner,assignee,tags&filter=equals(priority,'High')", + "launchUrl": "swagger", "applicationUrl": "https://localhost:44340;http://localhost:14140", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/src/Examples/JsonApiDotNetCoreExample/SetOpenApiServerAtBuildTimeFilter.cs b/src/Examples/JsonApiDotNetCoreExample/SetOpenApiServerAtBuildTimeFilter.cs new file mode 100644 index 0000000000..894c0d0966 --- /dev/null +++ b/src/Examples/JsonApiDotNetCoreExample/SetOpenApiServerAtBuildTimeFilter.cs @@ -0,0 +1,25 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCoreExample; + +/// +/// This is normally not needed. It ensures the server URL is added to the OpenAPI file during build. +/// +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class SetOpenApiServerAtBuildTimeFilter(IHttpContextAccessor httpContextAccessor) : IDocumentFilter +{ + private readonly IHttpContextAccessor _httpContextAccessor = httpContextAccessor; + + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + if (_httpContextAccessor.HttpContext == null) + { + swaggerDoc.Servers.Add(new OpenApiServer + { + Url = "https://localhost:44340" + }); + } + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/ColoredConsoleLogHttpMessageHandler.cs b/src/Examples/OpenApiKiotaClientExample/ColoredConsoleLogHttpMessageHandler.cs new file mode 100644 index 0000000000..e13aff5a4d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/ColoredConsoleLogHttpMessageHandler.cs @@ -0,0 +1,67 @@ +using JetBrains.Annotations; + +namespace OpenApiKiotaClientExample; + +/// +/// Writes incoming and outgoing HTTP messages to the console. +/// +internal sealed class ColoredConsoleLogHttpMessageHandler : DelegatingHandler +{ + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { +#if DEBUG + await LogRequestAsync(request, cancellationToken); +#endif + + HttpResponseMessage response = await base.SendAsync(request, cancellationToken); + +#if DEBUG + await LogResponseAsync(response, cancellationToken); +#endif + + return response; + } + + [UsedImplicitly] + private static async Task LogRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + using var _ = new ConsoleColorScope(ConsoleColor.Green); + + Console.WriteLine($"--> {request}"); + string? requestBody = request.Content != null ? await request.Content.ReadAsStringAsync(cancellationToken) : null; + + if (!string.IsNullOrEmpty(requestBody)) + { + Console.WriteLine(); + Console.WriteLine(requestBody); + } + } + + [UsedImplicitly] + private static async Task LogResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken) + { + using var _ = new ConsoleColorScope(ConsoleColor.Cyan); + + Console.WriteLine($"<-- {response}"); + string responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + + if (!string.IsNullOrEmpty(responseBody)) + { + Console.WriteLine(); + Console.WriteLine(responseBody); + } + } + + private sealed class ConsoleColorScope : IDisposable + { + public ConsoleColorScope(ConsoleColor foregroundColor) + { + Console.ForegroundColor = foregroundColor; + } + + public void Dispose() + { + Console.ResetColor(); + } + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/ApiRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/ApiRequestBuilder.cs new file mode 100644 index 0000000000..3d0f7361e7 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/ApiRequestBuilder.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.Operations; +using OpenApiKiotaClientExample.GeneratedCode.Api.People; +using OpenApiKiotaClientExample.GeneratedCode.Api.Tags; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api +{ + /// + /// Builds and executes requests for operations under \api + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ApiRequestBuilder : BaseRequestBuilder + { + /// The operations property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The people property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.PeopleRequestBuilder People + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.PeopleRequestBuilder(PathParameters, RequestAdapter); + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.TagsRequestBuilder Tags + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.TagsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.TodoItemsRequestBuilder TodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.TodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ApiRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ApiRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..96f21c5a24 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Operations +{ + /// + /// Builds and executes requests for operations under \api\operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..7bcc782af9 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems +{ + /// + /// Builds and executes requests for operations under \api\people\{id}\assignedTodoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AssignedTodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/assignedTodoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AssignedTodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/assignedTodoItems{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related todoItems of an individual person's assignedTodoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItems of an individual person's assignedTodoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems.AssignedTodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems.AssignedTodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItems of an individual person's assignedTodoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..2981e5fa65 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems +{ + /// + /// Builds and executes requests for operations under \api\people\{id}\ownedTodoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnedTodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/ownedTodoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnedTodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/ownedTodoItems{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related todoItems of an individual person's ownedTodoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItems of an individual person's ownedTodoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems.OwnedTodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems.OwnedTodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItems of an individual person's ownedTodoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/PeopleItemRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/PeopleItemRequestBuilder.cs new file mode 100644 index 0000000000..567ed904c8 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/PeopleItemRequestBuilder.cs @@ -0,0 +1,230 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item +{ + /// + /// Builds and executes requests for operations under \api\people\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleItemRequestBuilder : BaseRequestBuilder + { + /// The assignedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems.AssignedTodoItemsRequestBuilder AssignedTodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.AssignedTodoItems.AssignedTodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ownedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems.OwnedTodoItemsRequestBuilder OwnedTodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.OwnedTodoItems.OwnedTodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PeopleItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PeopleItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing person by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual person by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing person. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing person by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual person by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.PeopleItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.PeopleItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual person by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing person. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..14c018d51f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/AssignedTodoItems/AssignedTodoItemsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems +{ + /// + /// Builds and executes requests for operations under \api\people\{id}\relationships\assignedTodoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AssignedTodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships/assignedTodoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AssignedTodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships/assignedTodoItems{?query*}", rawUrl) + { + } + + /// + /// Removes existing todoItems from the assignedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItem identities of an individual person's assignedTodoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing todoItems to the assignedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing todoItems to the assignedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing todoItems from the assignedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related todoItem identities of an individual person's assignedTodoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing todoItems to the assignedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing todoItems to the assignedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems.AssignedTodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems.AssignedTodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItem identities of an individual person's assignedTodoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssignedTodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..9f27d97c3b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/OwnedTodoItems/OwnedTodoItemsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems +{ + /// + /// Builds and executes requests for operations under \api\people\{id}\relationships\ownedTodoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnedTodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships/ownedTodoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnedTodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships/ownedTodoItems{?query*}", rawUrl) + { + } + + /// + /// Removes existing todoItems from the ownedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItem identities of an individual person's ownedTodoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing todoItems to the ownedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing todoItems to the ownedTodoItems relationship of an individual person. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing todoItems from the ownedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related todoItem identities of an individual person's ownedTodoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing todoItems to the ownedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing todoItems to the ownedTodoItems relationship of an individual person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems.OwnedTodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems.OwnedTodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItem identities of an individual person's ownedTodoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnedTodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/RelationshipsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..2c9e9beafe --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \api\people\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The assignedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems.AssignedTodoItemsRequestBuilder AssignedTodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.AssignedTodoItems.AssignedTodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ownedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems.OwnedTodoItemsRequestBuilder OwnedTodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.Relationships.OwnedTodoItems.OwnedTodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/PeopleRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/PeopleRequestBuilder.cs new file mode 100644 index 0000000000..3a36d323c4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/People/PeopleRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.People.Item; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.People +{ + /// + /// Builds and executes requests for operations under \api\people + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaClientExample.GeneratedCode.api.people.item collection + /// The identifier of the person to retrieve. + /// A + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.PeopleItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.Item.PeopleItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PeopleRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PeopleRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/people{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of people. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new person. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of people. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new person. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.People.PeopleRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.People.PeopleRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of people. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new person. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PeopleRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/RelationshipsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..ecf2f5cc86 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \api\tags\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems.TodoItemsRequestBuilder TodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems.TodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/TodoItems/TodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/TodoItems/TodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..6020933f3d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/Relationships/TodoItems/TodoItemsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems +{ + /// + /// Builds and executes requests for operations under \api\tags\{id}\relationships\todoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/relationships/todoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/relationships/todoItems{?query*}", rawUrl) + { + } + + /// + /// Removes existing todoItems from the todoItems relationship of an individual tag. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItem identities of an individual tag's todoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing todoItems to the todoItems relationship of an individual tag. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing todoItems to the todoItems relationship of an individual tag. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing todoItems from the todoItems relationship of an individual tag. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related todoItem identities of an individual tag's todoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing todoItems to the todoItems relationship of an individual tag. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing todoItems to the todoItems relationship of an individual tag. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems.TodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.TodoItems.TodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItem identities of an individual tag's todoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TagsItemRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TagsItemRequestBuilder.cs new file mode 100644 index 0000000000..5321238e2b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TagsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships; +using OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item +{ + /// + /// Builds and executes requests for operations under \api\tags\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems.TodoItemsRequestBuilder TodoItems + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems.TodoItemsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TagsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TagsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing tag by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual tag by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing tag. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing tag by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual tag by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing tag. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TagsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TagsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual tag by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing tag. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TodoItems/TodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TodoItems/TodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..c5c673d844 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/Item/TodoItems/TodoItemsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems +{ + /// + /// Builds and executes requests for operations under \api\tags\{id}\todoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/todoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags/{id}/todoItems{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related todoItems of an individual tag's todoItems relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related todoItems of an individual tag's todoItems relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems.TodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TodoItems.TodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related todoItems of an individual tag's todoItems relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/TagsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/TagsRequestBuilder.cs new file mode 100644 index 0000000000..ccc88d242c --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/Tags/TagsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.Tags +{ + /// + /// Builds and executes requests for operations under \api\tags + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaClientExample.GeneratedCode.api.tags.item collection + /// The identifier of the tag to retrieve. + /// A + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TagsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.Item.TagsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/tags{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of tags. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new tag. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of tags. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new tag. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.TagsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.Tags.TagsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of tags. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new tag. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Assignee/AssigneeRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Assignee/AssigneeRequestBuilder.cs new file mode 100644 index 0000000000..10601bcef3 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Assignee/AssigneeRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\assignee + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AssigneeRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/assignee{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AssigneeRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/assignee{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related person of an individual todoItem's assignee relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related person of an individual todoItem's assignee relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee.AssigneeRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee.AssigneeRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related person of an individual todoItem's assignee relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Owner/OwnerRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Owner/OwnerRequestBuilder.cs new file mode 100644 index 0000000000..8fe72c9e38 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Owner/OwnerRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\owner + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/owner{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/owner{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related person of an individual todoItem's owner relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related person of an individual todoItem's owner relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner.OwnerRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner.OwnerRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related person of an individual todoItem's owner relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Assignee/AssigneeRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Assignee/AssigneeRequestBuilder.cs new file mode 100644 index 0000000000..5d775fbf73 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Assignee/AssigneeRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\relationships\assignee + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AssigneeRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/assignee{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AssigneeRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/assignee{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related person identity of an individual todoItem's assignee relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clears or assigns an existing person to the assignee relationship of an individual todoItem. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related person identity of an individual todoItem's assignee relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Clears or assigns an existing person to the assignee relationship of an individual todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee.AssigneeRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee.AssigneeRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related person identity of an individual todoItem's assignee relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AssigneeRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Owner/OwnerRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Owner/OwnerRequestBuilder.cs new file mode 100644 index 0000000000..abe58c712f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Owner/OwnerRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\relationships\owner + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/owner{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/owner{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related person identity of an individual todoItem's owner relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing person to the owner relationship of an individual todoItem. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related person identity of an individual todoItem's owner relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing person to the owner relationship of an individual todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner.OwnerRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner.OwnerRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related person identity of an individual todoItem's owner relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/RelationshipsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..0737f8ce56 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The assignee property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee.AssigneeRequestBuilder Assignee + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Assignee.AssigneeRequestBuilder(PathParameters, RequestAdapter); + } + + /// The owner property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner.OwnerRequestBuilder Owner + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Owner.OwnerRequestBuilder(PathParameters, RequestAdapter); + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags.TagsRequestBuilder Tags + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags.TagsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Tags/TagsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Tags/TagsRequestBuilder.cs new file mode 100644 index 0000000000..0dc145b7f0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Relationships/Tags/TagsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\relationships\tags + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/tags{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/relationships/tags{?query*}", rawUrl) + { + } + + /// + /// Removes existing tags from the tags relationship of an individual todoItem. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related tag identities of an individual todoItem's tags relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing tags to the tags relationship of an individual todoItem. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing tags to the tags relationship of an individual todoItem. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing tags from the tags relationship of an individual todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related tag identities of an individual todoItem's tags relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing tags to the tags relationship of an individual todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing tags to the tags relationship of an individual todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags.TagsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.Tags.TagsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related tag identities of an individual todoItem's tags relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Tags/TagsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Tags/TagsRequestBuilder.cs new file mode 100644 index 0000000000..bddab801c4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/Tags/TagsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id}\tags + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/tags{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TagsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}/tags{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related tags of an individual todoItem's tags relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TagCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related tags of an individual todoItem's tags relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags.TagsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags.TagsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related tags of an individual todoItem's tags relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TagsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/TodoItemsItemRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/TodoItemsItemRequestBuilder.cs new file mode 100644 index 0000000000..2383afe1a0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/Item/TodoItemsItemRequestBuilder.cs @@ -0,0 +1,237 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item +{ + /// + /// Builds and executes requests for operations under \api\todoItems\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsItemRequestBuilder : BaseRequestBuilder + { + /// The assignee property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee.AssigneeRequestBuilder Assignee + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Assignee.AssigneeRequestBuilder(PathParameters, RequestAdapter); + } + + /// The owner property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner.OwnerRequestBuilder Owner + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Owner.OwnerRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags.TagsRequestBuilder Tags + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.Tags.TagsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TodoItemsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TodoItemsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing todoItem by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual todoItem by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing todoItem. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing todoItem by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual todoItem by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.TodoItemsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.TodoItemsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual todoItem by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing todoItem. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/TodoItemsRequestBuilder.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/TodoItemsRequestBuilder.cs new file mode 100644 index 0000000000..bc3feeaf22 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Api/TodoItems/TodoItemsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item; +using OpenApiKiotaClientExample.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems +{ + /// + /// Builds and executes requests for operations under \api\todoItems + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaClientExample.GeneratedCode.api.todoItems.item collection + /// The identifier of the todoItem to retrieve. + /// A + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.TodoItemsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.Item.TodoItemsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TodoItemsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/api/todoItems{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of todoItems. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new todoItem. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of todoItems. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new todoItem. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.TodoItemsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaClientExample.GeneratedCode.Api.TodoItems.TodoItemsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of todoItems. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new todoItem. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TodoItemsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/ExampleApiClient.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/ExampleApiClient.cs new file mode 100644 index 0000000000..15ea897045 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/ExampleApiClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaClientExample.GeneratedCode.Api; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExampleApiClient : BaseRequestBuilder + { + /// The api property + public global::OpenApiKiotaClientExample.GeneratedCode.Api.ApiRequestBuilder Api + { + get => new global::OpenApiKiotaClientExample.GeneratedCode.Api.ApiRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public ExampleApiClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "https://localhost:44340"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddOperationCode.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddOperationCode.cs new file mode 100644 index 0000000000..eb7b72025a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum AddOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "add")] + #pragma warning disable CS1591 + Add, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonAssignedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonAssignedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..e45dc51ebf --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonAssignedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToPersonAssignedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonAssignedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonAssignedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonOwnedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonOwnedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..23f7ef0320 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToPersonOwnedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToPersonOwnedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonOwnedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonOwnedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTagTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTagTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..960e6aa8dc --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTagTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToTagTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTagTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTagTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTodoItemTagsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTodoItemTagsRelationshipOperation.cs new file mode 100644 index 0000000000..69f97a3707 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AddToTodoItemTagsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToTodoItemTagsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTodoItemTagsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTodoItemTagsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..3703a87e02 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,106 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addPerson" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonOperation(), + "addTag" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagOperation(), + "addTodoItem" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemOperation(), + "addToPersonAssignedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonAssignedTodoItemsRelationshipOperation(), + "addToPersonOwnedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToPersonOwnedTodoItemsRelationshipOperation(), + "addToTagTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTagTodoItemsRelationshipOperation(), + "addToTodoItemTags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AddToTodoItemTagsRelationshipOperation(), + "removeFromPersonAssignedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonAssignedTodoItemsRelationshipOperation(), + "removeFromPersonOwnedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonOwnedTodoItemsRelationshipOperation(), + "removeFromTagTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTagTodoItemsRelationshipOperation(), + "removeFromTodoItemTags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTodoItemTagsRelationshipOperation(), + "removePerson" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeletePersonOperation(), + "removeTag" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTagOperation(), + "removeTodoItem" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTodoItemOperation(), + "updatePerson" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOperation(), + "updatePersonAssignedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonAssignedTodoItemsRelationshipOperation(), + "updatePersonOwnedTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOwnedTodoItemsRelationshipOperation(), + "updateTag" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagOperation(), + "updateTagTodoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagTodoItemsRelationshipOperation(), + "updateTodoItem" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOperation(), + "updateTodoItemAssignee" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemAssigneeRelationshipOperation(), + "updateTodoItemOwner" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOwnerRelationshipOperation(), + "updateTodoItemTags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemTagsRelationshipOperation(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicResult.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..8be7f5afd5 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs new file mode 100644 index 0000000000..b26154383a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreatePersonRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..19fb0fdd8b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs new file mode 100644 index 0000000000..b191d1ad18 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTagRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs new file mode 100644 index 0000000000..d783a50dfa --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInCreateTodoItemRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The durationInHours property + public long? DurationInHours + { + get { return BackingStore?.Get("durationInHours"); } + set { BackingStore?.Set("durationInHours", value); } + } + + /// The priority property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPriority? Priority + { + get { return BackingStore?.Get("priority"); } + set { BackingStore?.Set("priority", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "durationInHours", n => { DurationInHours = n.GetLongValue(); } }, + { "priority", n => { Priority = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteLongValue("durationInHours", DurationInHours); + writer.WriteEnumValue("priority", Priority); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs new file mode 100644 index 0000000000..ab1156dd4a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInPersonResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The displayName property + public string? DisplayName + { + get { return BackingStore?.Get("displayName"); } + set { BackingStore?.Set("displayName", value); } + } + + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "displayName", n => { DisplayName = n.GetStringValue(); } }, + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..6ff4a6df92 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs new file mode 100644 index 0000000000..1c17475540 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTagResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs new file mode 100644 index 0000000000..e3d822bc8d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInTodoItemResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The createdAt property + public DateTimeOffset? CreatedAt + { + get { return BackingStore?.Get("createdAt"); } + set { BackingStore?.Set("createdAt", value); } + } + + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The durationInHours property + public long? DurationInHours + { + get { return BackingStore?.Get("durationInHours"); } + set { BackingStore?.Set("durationInHours", value); } + } + + /// The modifiedAt property + public DateTimeOffset? ModifiedAt + { + get { return BackingStore?.Get("modifiedAt"); } + set { BackingStore?.Set("modifiedAt", value); } + } + + /// The priority property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPriority? Priority + { + get { return BackingStore?.Get("priority"); } + set { BackingStore?.Set("priority", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "createdAt", n => { CreatedAt = n.GetDateTimeOffsetValue(); } }, + { "description", n => { Description = n.GetStringValue(); } }, + { "durationInHours", n => { DurationInHours = n.GetLongValue(); } }, + { "modifiedAt", n => { ModifiedAt = n.GetDateTimeOffsetValue(); } }, + { "priority", n => { Priority = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateTimeOffsetValue("createdAt", CreatedAt); + writer.WriteStringValue("description", Description); + writer.WriteLongValue("durationInHours", DurationInHours); + writer.WriteDateTimeOffsetValue("modifiedAt", ModifiedAt); + writer.WriteEnumValue("priority", Priority); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs new file mode 100644 index 0000000000..eac162ccac --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdatePersonRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..3da7558632 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs new file mode 100644 index 0000000000..4f09c54701 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTagRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs new file mode 100644 index 0000000000..bac8e0a4d9 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/AttributesInUpdateTodoItemRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The durationInHours property + public long? DurationInHours + { + get { return BackingStore?.Get("durationInHours"); } + set { BackingStore?.Set("durationInHours", value); } + } + + /// The priority property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemPriority? Priority + { + get { return BackingStore?.Get("priority"); } + set { BackingStore?.Set("priority", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "durationInHours", n => { DurationInHours = n.GetLongValue(); } }, + { "priority", n => { Priority = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteLongValue("durationInHours", DurationInHours); + writer.WriteEnumValue("priority", Priority); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonOperation.cs new file mode 100644 index 0000000000..c3c532fe55 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreatePersonOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs new file mode 100644 index 0000000000..506e9b2d18 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreatePersonRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreatePersonRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreatePersonRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreatePersonRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagOperation.cs new file mode 100644 index 0000000000..18304dc659 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTagOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs new file mode 100644 index 0000000000..f339b44870 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTagRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTagRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateTagRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTagRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemOperation.cs new file mode 100644 index 0000000000..a879dba99a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTodoItemOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs new file mode 100644 index 0000000000..d3857f3ef4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/CreateTodoItemRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTodoItemRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateTodoItemRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.CreateTodoItemRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs new file mode 100644 index 0000000000..a73695584b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreatePersonRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreatePersonRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs new file mode 100644 index 0000000000..705018cfa6 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTagRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTagRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs new file mode 100644 index 0000000000..e1493f92ca --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInCreateTodoItemRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs new file mode 100644 index 0000000000..102783642e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInPersonResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInPersonResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs new file mode 100644 index 0000000000..d32e8dd080 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTagResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTagResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs new file mode 100644 index 0000000000..abe7290e36 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInTodoItemResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInTodoItemResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs new file mode 100644 index 0000000000..4cc76e39b0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdatePersonRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs new file mode 100644 index 0000000000..67e8f056d0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTagRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTagRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs new file mode 100644 index 0000000000..f3500e1884 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DataInUpdateTodoItemRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.AttributesInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeletePersonOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeletePersonOperation.cs new file mode 100644 index 0000000000..a935cf7f39 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeletePersonOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeletePersonOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeletePersonOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeletePersonOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTagOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTagOperation.cs new file mode 100644 index 0000000000..2fc9ab07e4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTagOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeleteTagOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTagOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTagOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTodoItemOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTodoItemOperation.cs new file mode 100644 index 0000000000..4078148c04 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/DeleteTodoItemOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeleteTodoItemOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTodoItemOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.DeleteTodoItemOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..14988baa15 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorObject.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..54b277a3e4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..fa3d55ee54 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorSource.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..2c2b7e45cc --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..bf238e2e6e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/IdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..a997c6e0bf --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Meta.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..1e5f665402 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs new file mode 100644 index 0000000000..245fb8a3bb --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullablePersonIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullablePersonIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullablePersonIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullablePersonIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs new file mode 100644 index 0000000000..f3a621d45c --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableSecondaryPersonResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableSecondaryPersonResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableSecondaryPersonResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableSecondaryPersonResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs new file mode 100644 index 0000000000..5eab19e48b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOnePersonInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOnePersonInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs new file mode 100644 index 0000000000..0de8cf3d6e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/NullableToOnePersonInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOnePersonInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOnePersonInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..3bd1932eb1 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..1c9588a0c5 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipIdentifier.cs new file mode 100644 index 0000000000..e4b6d93b90 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonAssignedTodoItemsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PersonAssignedTodoItemsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipName.cs new file mode 100644 index 0000000000..bef09282ad --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonAssignedTodoItemsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum PersonAssignedTodoItemsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "assignedTodoItems")] + #pragma warning disable CS1591 + AssignedTodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs new file mode 100644 index 0000000000..3b92c217c9 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PersonCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs new file mode 100644 index 0000000000..45aadb8951 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs new file mode 100644 index 0000000000..7c051da21f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PersonIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs new file mode 100644 index 0000000000..a7ca24727d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PersonIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipIdentifier.cs new file mode 100644 index 0000000000..62e03c01f8 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PersonOwnedTodoItemsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PersonOwnedTodoItemsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipName.cs new file mode 100644 index 0000000000..5c7c841a13 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonOwnedTodoItemsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum PersonOwnedTodoItemsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "ownedTodoItems")] + #pragma warning disable CS1591 + OwnedTodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonResourceType.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonResourceType.cs new file mode 100644 index 0000000000..309e481056 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PersonResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum PersonResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "people")] + #pragma warning disable CS1591 + People, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs new file mode 100644 index 0000000000..769819ff5d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryPersonResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryPersonResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryPersonResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryPersonResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs new file mode 100644 index 0000000000..56faf94dec --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTagResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryTagResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryTagResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTagResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs new file mode 100644 index 0000000000..2aefc28121 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/PrimaryTodoItemResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryTodoItemResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryTodoItemResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.PrimaryTodoItemResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..1dfc44ee8d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs new file mode 100644 index 0000000000..a7c1dc9803 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreatePersonRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The assignedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? AssignedTodoItems + { + get { return BackingStore?.Get("assignedTodoItems"); } + set { BackingStore?.Set("assignedTodoItems", value); } + } + + /// The ownedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? OwnedTodoItems + { + get { return BackingStore?.Get("ownedTodoItems"); } + set { BackingStore?.Set("ownedTodoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); + writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..c9c8d2247d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs new file mode 100644 index 0000000000..6faaa2cb56 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTagRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? TodoItems + { + get { return BackingStore?.Get("todoItems"); } + set { BackingStore?.Set("todoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("todoItems", TodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs new file mode 100644 index 0000000000..0a8e32873b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInCreateTodoItemRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The assignee property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest? Assignee + { + get { return BackingStore?.Get("assignee"); } + set { BackingStore?.Set("assignee", value); } + } + + /// The owner property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest? Tags + { + get { return BackingStore?.Get("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInCreateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest.CreateFromDiscriminatorValue); } }, + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest.CreateFromDiscriminatorValue); } }, + { "tags", n => { Tags = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignee", Assignee); + writer.WriteObjectValue("owner", Owner); + writer.WriteObjectValue("tags", Tags); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs new file mode 100644 index 0000000000..700c9b301a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInPersonResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInPersonResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The assignedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse? AssignedTodoItems + { + get { return BackingStore?.Get("assignedTodoItems"); } + set { BackingStore?.Set("assignedTodoItems", value); } + } + + /// The ownedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse? OwnedTodoItems + { + get { return BackingStore?.Get("ownedTodoItems"); } + set { BackingStore?.Set("ownedTodoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, + { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); + writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..037808aa1f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs new file mode 100644 index 0000000000..eb854e08d8 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTagResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInTagResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse? TodoItems + { + get { return BackingStore?.Get("todoItems"); } + set { BackingStore?.Set("todoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTagResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("todoItems", TodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs new file mode 100644 index 0000000000..56e9402ada --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInTodoItemResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInTodoItemResponse : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The assignee property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInResponse? Assignee + { + get { return BackingStore?.Get("assignee"); } + set { BackingStore?.Set("assignee", value); } + } + + /// The owner property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInResponse? Tags + { + get { return BackingStore?.Get("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInTodoItemResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInResponse.CreateFromDiscriminatorValue); } }, + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse.CreateFromDiscriminatorValue); } }, + { "tags", n => { Tags = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignee", Assignee); + writer.WriteObjectValue("owner", Owner); + writer.WriteObjectValue("tags", Tags); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs new file mode 100644 index 0000000000..ee9185a310 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdatePersonRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdatePersonRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The assignedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? AssignedTodoItems + { + get { return BackingStore?.Get("assignedTodoItems"); } + set { BackingStore?.Set("assignedTodoItems", value); } + } + + /// The ownedTodoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? OwnedTodoItems + { + get { return BackingStore?.Get("ownedTodoItems"); } + set { BackingStore?.Set("ownedTodoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignedTodoItems", n => { AssignedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + { "ownedTodoItems", n => { OwnedTodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignedTodoItems", AssignedTodoItems); + writer.WriteObjectValue("ownedTodoItems", OwnedTodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..13621d8e84 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs new file mode 100644 index 0000000000..87a99d727d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTagRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateTagRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The todoItems property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest? TodoItems + { + get { return BackingStore?.Get("todoItems"); } + set { BackingStore?.Set("todoItems", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTagRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "todoItems", n => { TodoItems = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("todoItems", TodoItems); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs new file mode 100644 index 0000000000..0503466973 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RelationshipsInUpdateTodoItemRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateTodoItemRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The assignee property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest? Assignee + { + get { return BackingStore?.Get("assignee"); } + set { BackingStore?.Set("assignee", value); } + } + + /// The owner property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// The tags property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest? Tags + { + get { return BackingStore?.Get("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipsInUpdateTodoItemRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "assignee", n => { Assignee = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.NullableToOnePersonInRequest.CreateFromDiscriminatorValue); } }, + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest.CreateFromDiscriminatorValue); } }, + { "tags", n => { Tags = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("assignee", Assignee); + writer.WriteObjectValue("owner", Owner); + writer.WriteObjectValue("tags", Tags); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonAssignedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonAssignedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..a1723493b7 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonAssignedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromPersonAssignedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonAssignedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonAssignedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonOwnedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonOwnedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..d382626143 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromPersonOwnedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromPersonOwnedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonOwnedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromPersonOwnedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTagTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTagTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..dac043b40f --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTagTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromTagTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTagTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTagTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTodoItemTagsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTodoItemTagsRelationshipOperation.cs new file mode 100644 index 0000000000..728838ac24 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveFromTodoItemTagsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromTodoItemTagsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTodoItemTagsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.RemoveFromTodoItemTagsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveOperationCode.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..e49087bf47 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..2eff9f8e0e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..5c45ab0eb8 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..853e4af142 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..091cfb0a93 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInCreateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..b5417c7dd0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..f59c44514e --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "people" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest(), + "tags" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest(), + "todoItems" => new global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest(), + _ => new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..e0b061e6b0 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..1f2666f23d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..0fa83203d6 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "people")] + #pragma warning disable CS1591 + People, + #pragma warning restore CS1591 + [EnumMember(Value = "tags")] + #pragma warning disable CS1591 + Tags, + #pragma warning restore CS1591 + [EnumMember(Value = "todoItems")] + #pragma warning disable CS1591 + TodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs new file mode 100644 index 0000000000..2ca28ffaba --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/SecondaryPersonResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryPersonResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryPersonResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.SecondaryPersonResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInPersonResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs new file mode 100644 index 0000000000..8a8212126b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TagCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TagCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTagResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..30ef21fd5a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TagIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TagIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs new file mode 100644 index 0000000000..b1fa1ae9ea --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TagIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs new file mode 100644 index 0000000000..6da97abc35 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TagIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TagIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagResourceType.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagResourceType.cs new file mode 100644 index 0000000000..5cc9335c56 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TagResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "tags")] + #pragma warning disable CS1591 + Tags, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipIdentifier.cs new file mode 100644 index 0000000000..1575de9edd --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TagTodoItemsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TagTodoItemsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipName.cs new file mode 100644 index 0000000000..688ef7a666 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TagTodoItemsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TagTodoItemsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "todoItems")] + #pragma warning disable CS1591 + TodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs new file mode 100644 index 0000000000..f4b01be848 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTagInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTagInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs new file mode 100644 index 0000000000..499498c582 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTagInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTagInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTagInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTagInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs new file mode 100644 index 0000000000..4278fbdcf1 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTodoItemInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTodoItemInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs new file mode 100644 index 0000000000..cdb6ae027d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToManyTodoItemInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTodoItemInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTodoItemInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToManyTodoItemInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs new file mode 100644 index 0000000000..054d054a47 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOnePersonInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOnePersonInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs new file mode 100644 index 0000000000..7223b715cb --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/ToOnePersonInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOnePersonInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOnePersonInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.ToOnePersonInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipIdentifier.cs new file mode 100644 index 0000000000..b3776ea784 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemAssigneeRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAssigneeRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemAssigneeRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAssigneeRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAssigneeRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipName.cs new file mode 100644 index 0000000000..ab067713d3 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemAssigneeRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TodoItemAssigneeRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "assignee")] + #pragma warning disable CS1591 + Assignee, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs new file mode 100644 index 0000000000..39924b4e0c --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInTodoItemResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..07f5dc0740 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs new file mode 100644 index 0000000000..625c96abfe --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemIdentifierInRequest : global::OpenApiKiotaClientExample.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs new file mode 100644 index 0000000000..77e66a4932 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipIdentifier.cs new file mode 100644 index 0000000000..9280347acf --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemOwnerRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemOwnerRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemOwnerRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemOwnerRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemOwnerRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipName.cs new file mode 100644 index 0000000000..9b93bc5cf2 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemOwnerRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TodoItemOwnerRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "owner")] + #pragma warning disable CS1591 + Owner, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPriority.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPriority.cs new file mode 100644 index 0000000000..1736350c36 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemPriority.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TodoItemPriority + #pragma warning restore CS1591 + { + [EnumMember(Value = "High")] + #pragma warning disable CS1591 + High, + #pragma warning restore CS1591 + [EnumMember(Value = "Medium")] + #pragma warning disable CS1591 + Medium, + #pragma warning restore CS1591 + [EnumMember(Value = "Low")] + #pragma warning disable CS1591 + Low, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemResourceType.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemResourceType.cs new file mode 100644 index 0000000000..3f6583ffa8 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TodoItemResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "todoItems")] + #pragma warning disable CS1591 + TodoItems, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipIdentifier.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipIdentifier.cs new file mode 100644 index 0000000000..8f60910bf9 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TodoItemTagsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TodoItemTagsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipName.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipName.cs new file mode 100644 index 0000000000..e5c0a6aecd --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/TodoItemTagsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TodoItemTagsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "tags")] + #pragma warning disable CS1591 + Tags, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateOperationCode.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..615d734065 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonAssignedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonAssignedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..4e49dae8ab --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonAssignedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdatePersonAssignedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonAssignedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonAssignedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonAssignedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOperation.cs new file mode 100644 index 0000000000..d9f9ebc327 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdatePersonOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOwnedTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOwnedTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..d3897e3e91 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonOwnedTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdatePersonOwnedTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOwnedTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonOwnedTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonOwnedTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs new file mode 100644 index 0000000000..6a66c970c4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdatePersonRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdatePersonRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdatePersonRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdatePersonRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdatePersonRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagOperation.cs new file mode 100644 index 0000000000..a6f95262a7 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTagOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs new file mode 100644 index 0000000000..7bd46becea --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTagRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateTagRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTagRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagTodoItemsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagTodoItemsRelationshipOperation.cs new file mode 100644 index 0000000000..d566ab853a --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTagTodoItemsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTagTodoItemsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagTodoItemsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTagTodoItemsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagTodoItemsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemAssigneeRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemAssigneeRelationshipOperation.cs new file mode 100644 index 0000000000..c97917c75b --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemAssigneeRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTodoItemAssigneeRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAssigneeRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemAssigneeRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemAssigneeRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemAssigneeRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOperation.cs new file mode 100644 index 0000000000..6e98779249 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTodoItemOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOwnerRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOwnerRelationshipOperation.cs new file mode 100644 index 0000000000..15a12c97f3 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemOwnerRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTodoItemOwnerRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemOwnerRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOwnerRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemOwnerRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.PersonIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemOwnerRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs new file mode 100644 index 0000000000..1d39ef6392 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTodoItemRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateTodoItemRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.DataInUpdateTodoItemRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemTagsRelationshipOperation.cs b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemTagsRelationshipOperation.cs new file mode 100644 index 0000000000..68b848e164 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/GeneratedCode/Models/UpdateTodoItemTagsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaClientExample.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTodoItemTagsRelationshipOperation : global::OpenApiKiotaClientExample.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemTagsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaClientExample.GeneratedCode.Models.UpdateTodoItemTagsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaClientExample.GeneratedCode.Models.TagIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaClientExample.GeneratedCode.Models.TodoItemTagsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj b/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj new file mode 100644 index 0000000000..8f65b2b688 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/OpenApiKiotaClientExample.csproj @@ -0,0 +1,28 @@ + + + net9.0 + + + + + + + + + + + + + + + + + + + $(MSBuildProjectName).GeneratedCode + ExampleApiClient + ./GeneratedCode + $(JsonApiExtraArguments) + + + diff --git a/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs b/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs new file mode 100644 index 0000000000..db22ae6231 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/PeopleMessageFormatter.cs @@ -0,0 +1,65 @@ +using System.Text; +using JetBrains.Annotations; +using OpenApiKiotaClientExample.GeneratedCode.Models; + +namespace OpenApiKiotaClientExample; + +/// +/// Prints the specified people, their assigned todo-items, and its tags. +/// +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class PeopleMessageFormatter +{ + public static void PrintPeople(PersonCollectionResponseDocument? peopleResponse) + { + string message = WritePeople(peopleResponse); + Console.WriteLine(message); + } + + private static string WritePeople(PersonCollectionResponseDocument? peopleResponse) + { + if (peopleResponse == null) + { + return "No response body was returned."; + } + + var builder = new StringBuilder(); + builder.AppendLine($"Found {peopleResponse.Data!.Count} people:"); + + foreach (DataInPersonResponse person in peopleResponse.Data) + { + WritePerson(person, peopleResponse.Included ?? [], builder); + } + + return builder.ToString(); + } + + private static void WritePerson(DataInPersonResponse person, List includes, StringBuilder builder) + { + List assignedTodoItems = person.Relationships?.AssignedTodoItems?.Data ?? []; + + builder.AppendLine($" Person {person.Id}: {person.Attributes?.DisplayName} with {assignedTodoItems.Count} assigned todo-items:"); + WriteRelatedTodoItems(assignedTodoItems, includes, builder); + } + + private static void WriteRelatedTodoItems(List todoItemIdentifiers, List includes, StringBuilder builder) + { + foreach (TodoItemIdentifierInResponse todoItemIdentifier in todoItemIdentifiers) + { + DataInTodoItemResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); + List tags = includedTodoItem.Relationships?.Tags?.Data ?? []; + + builder.AppendLine($" TodoItem {includedTodoItem.Id}: {includedTodoItem.Attributes?.Description} with {tags.Count} tags:"); + WriteRelatedTags(tags, includes, builder); + } + } + + private static void WriteRelatedTags(List tagIdentifiers, List includes, StringBuilder builder) + { + foreach (TagIdentifierInResponse tagIdentifier in tagIdentifiers) + { + DataInTagResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); + builder.AppendLine($" Tag {includedTag.Id}: {includedTag.Attributes?.Name}"); + } + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/Program.cs b/src/Examples/OpenApiKiotaClientExample/Program.cs new file mode 100644 index 0000000000..2716335282 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/Program.cs @@ -0,0 +1,37 @@ +using JsonApiDotNetCore.OpenApi.Client.Kiota; +using Microsoft.Kiota.Abstractions.Authentication; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaClientExample; +using OpenApiKiotaClientExample.GeneratedCode; + +HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); +builder.Services.AddLogging(options => options.ClearProviders()); +builder.Services.AddHostedService(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); + +// @formatter:wrap_chained_method_calls chop_always +builder.Services.AddHttpClient() + .ConfigurePrimaryHttpMessageHandler(_ => + { + IList defaultHandlers = KiotaClientFactory.CreateDefaultHandlers(); + HttpMessageHandler defaultHttpMessageHandler = KiotaClientFactory.GetDefaultHttpMessageHandler(); + + // Or, if your generated client is long-lived, respond to DNS updates using: + // HttpMessageHandler defaultHttpMessageHandler = new SocketsHttpHandler(); + + return KiotaClientFactory.ChainHandlersCollectionAndGetFirstLink(defaultHttpMessageHandler, defaultHandlers.ToArray())!; + }) + .AddHttpMessageHandler() + .AddHttpMessageHandler() + .AddTypedClient((httpClient, serviceProvider) => + { + var authenticationProvider = serviceProvider.GetRequiredService(); + var requestAdapter = new HttpClientRequestAdapter(authenticationProvider, httpClient: httpClient); + return new ExampleApiClient(requestAdapter); + }); +// @formatter:wrap_chained_method_calls restore + +IHost host = builder.Build(); +await host.RunAsync(); diff --git a/src/Examples/OpenApiKiotaClientExample/Properties/launchSettings.json b/src/Examples/OpenApiKiotaClientExample/Properties/launchSettings.json new file mode 100644 index 0000000000..afb5e5dac4 --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Kestrel": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/Worker.cs b/src/Examples/OpenApiKiotaClientExample/Worker.cs new file mode 100644 index 0000000000..56c6cd6b0d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/Worker.cs @@ -0,0 +1,212 @@ +using System.Net; +using JsonApiDotNetCore.OpenApi.Client.Kiota; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Http.HttpClientLibrary.Middleware.Options; +using OpenApiKiotaClientExample.GeneratedCode; +using OpenApiKiotaClientExample.GeneratedCode.Models; + +namespace OpenApiKiotaClientExample; + +public sealed class Worker(ExampleApiClient apiClient, IHostApplicationLifetime hostApplicationLifetime, SetQueryStringHttpMessageHandler queryStringHandler) + : BackgroundService +{ + private readonly ExampleApiClient _apiClient = apiClient; + private readonly IHostApplicationLifetime _hostApplicationLifetime = hostApplicationLifetime; + private readonly SetQueryStringHttpMessageHandler _queryStringHandler = queryStringHandler; + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + try + { + using (_queryStringHandler.CreateScope(new Dictionary + { + // Workaround for https://github.com/microsoft/kiota/issues/3800. + ["filter"] = "has(assignedTodoItems)", + ["sort"] = "-lastName", + ["page[size]"] = "5", + ["include"] = "assignedTodoItems.tags" + })) + { + (PersonCollectionResponseDocument? getResponse, string? eTag) = await GetPeopleAsync(_apiClient, null, stoppingToken); + PeopleMessageFormatter.PrintPeople(getResponse); + + (PersonCollectionResponseDocument? getResponseAgain, _) = await GetPeopleAsync(_apiClient, eTag, stoppingToken); + PeopleMessageFormatter.PrintPeople(getResponseAgain); + } + + await UpdatePersonAsync(stoppingToken); + + await SendOperationsRequestAsync(stoppingToken); + + await _apiClient.Api.People["999999"].GetAsync(cancellationToken: stoppingToken); + } + catch (ErrorResponseDocument exception) + { + Console.WriteLine($"JSON:API ERROR: {exception.Errors!.First().Detail}"); + } + catch (HttpRequestException exception) + { + Console.WriteLine($"ERROR: {exception.Message}"); + } + + _hostApplicationLifetime.StopApplication(); + } + + private static async Task<(PersonCollectionResponseDocument? response, string? eTag)> GetPeopleAsync(ExampleApiClient apiClient, string? ifNoneMatch, + CancellationToken cancellationToken) + { + try + { + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + PersonCollectionResponseDocument? response = await apiClient.Api.People.GetAsync(configuration => + { + if (!string.IsNullOrEmpty(ifNoneMatch)) + { + configuration.Headers.Add("If-None-Match", ifNoneMatch); + } + + configuration.Options.Add(headerInspector); + }, cancellationToken); + + string eTag = headerInspector.ResponseHeaders["ETag"].Single(); + + return (response, eTag); + } + // Workaround for https://github.com/microsoft/kiota/issues/4190. + catch (ApiException exception) when (exception.ResponseStatusCode == (int)HttpStatusCode.NotModified) + { + return (null, null); + } + } + + private async Task UpdatePersonAsync(CancellationToken cancellationToken) + { + var updatePersonRequest = new UpdatePersonRequestDocument + { + Data = new DataInUpdatePersonRequest + { + Type = ResourceType.People, + Id = "1", + Attributes = new AttributesInUpdatePersonRequest + { + // The --backing-store switch enables to send null and default values. + FirstName = null, + LastName = "Doe" + } + } + }; + + await _apiClient.Api.People[updatePersonRequest.Data.Id].PatchAsync(updatePersonRequest, cancellationToken: cancellationToken); + } + + private async Task SendOperationsRequestAsync(CancellationToken cancellationToken) + { + var operationsRequest = new OperationsRequestDocument + { + AtomicOperations = + [ + new CreateTagOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateTagRequest + { + Type = ResourceType.Tags, + Lid = "new-tag", + Attributes = new AttributesInCreateTagRequest + { + Name = "Housekeeping" + } + } + }, + new CreatePersonOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreatePersonRequest + { + Type = ResourceType.People, + Lid = "new-person", + Attributes = new AttributesInCreatePersonRequest + { + FirstName = "Cinderella", + LastName = "Tremaine" + } + } + }, + new UpdatePersonOperation + { + Op = UpdateOperationCode.Update, + Data = new DataInUpdatePersonRequest + { + Type = ResourceType.People, + Lid = "new-person", + Attributes = new AttributesInUpdatePersonRequest + { + // The --backing-store switch enables to send null and default values. + FirstName = null + } + } + }, + new CreateTodoItemOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateTodoItemRequest + { + Type = ResourceType.TodoItems, + Lid = "new-todo-item", + Attributes = new AttributesInCreateTodoItemRequest + { + Description = "Put out the garbage", + Priority = TodoItemPriority.Medium + }, + Relationships = new RelationshipsInCreateTodoItemRequest + { + Owner = new ToOnePersonInRequest + { + Data = new PersonIdentifierInRequest + { + Type = ResourceType.People, + Lid = "new-person" + } + }, + Tags = new ToManyTagInRequest + { + Data = + [ + new TagIdentifierInRequest + { + Type = ResourceType.Tags, + Lid = "new-tag" + } + ] + } + } + } + }, + new UpdateTodoItemAssigneeRelationshipOperation + { + Op = UpdateOperationCode.Update, + Ref = new TodoItemAssigneeRelationshipIdentifier + { + Type = TodoItemResourceType.TodoItems, + Lid = "new-todo-item", + Relationship = TodoItemAssigneeRelationshipName.Assignee + }, + Data = new PersonIdentifierInRequest + { + Type = ResourceType.People, + Lid = "new-person" + } + } + ] + }; + + OperationsResponseDocument? operationsResponse = await _apiClient.Api.Operations.PostAsync(operationsRequest, cancellationToken: cancellationToken); + + var newTodoItem = (DataInTodoItemResponse)operationsResponse!.AtomicResults!.ElementAt(3).Data!; + Console.WriteLine($"Created todo-item with ID {newTodoItem.Id}: {newTodoItem.Attributes!.Description}."); + } +} diff --git a/src/Examples/OpenApiKiotaClientExample/appsettings.json b/src/Examples/OpenApiKiotaClientExample/appsettings.json new file mode 100644 index 0000000000..2b94cdb46d --- /dev/null +++ b/src/Examples/OpenApiKiotaClientExample/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Information" + } + } +} diff --git a/src/Examples/OpenApiNSwagClientExample/.editorconfig b/src/Examples/OpenApiNSwagClientExample/.editorconfig new file mode 100644 index 0000000000..e2ec1cac44 --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/.editorconfig @@ -0,0 +1,3 @@ +# Workaround for incorrect nullability in NSwag generated clients. +[*Client.cs] +dotnet_diagnostic.CS8765.severity = none diff --git a/src/Examples/OpenApiNSwagClientExample/ColoredConsoleLogHttpMessageHandler.cs b/src/Examples/OpenApiNSwagClientExample/ColoredConsoleLogHttpMessageHandler.cs new file mode 100644 index 0000000000..d999a7d9bf --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/ColoredConsoleLogHttpMessageHandler.cs @@ -0,0 +1,67 @@ +using JetBrains.Annotations; + +namespace OpenApiNSwagClientExample; + +/// +/// Writes incoming and outgoing HTTP messages to the console. +/// +internal sealed class ColoredConsoleLogHttpMessageHandler : DelegatingHandler +{ + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { +#if DEBUG + await LogRequestAsync(request, cancellationToken); +#endif + + HttpResponseMessage response = await base.SendAsync(request, cancellationToken); + +#if DEBUG + await LogResponseAsync(response, cancellationToken); +#endif + + return response; + } + + [UsedImplicitly] + private static async Task LogRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + using var _ = new ConsoleColorScope(ConsoleColor.Green); + + Console.WriteLine($"--> {request}"); + string? requestBody = request.Content != null ? await request.Content.ReadAsStringAsync(cancellationToken) : null; + + if (!string.IsNullOrEmpty(requestBody)) + { + Console.WriteLine(); + Console.WriteLine(requestBody); + } + } + + [UsedImplicitly] + private static async Task LogResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken) + { + using var _ = new ConsoleColorScope(ConsoleColor.Cyan); + + Console.WriteLine($"<-- {response}"); + string responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + + if (!string.IsNullOrEmpty(responseBody)) + { + Console.WriteLine(); + Console.WriteLine(responseBody); + } + } + + private sealed class ConsoleColorScope : IDisposable + { + public ConsoleColorScope(ConsoleColor foregroundColor) + { + Console.ForegroundColor = foregroundColor; + } + + public void Dispose() + { + Console.ResetColor(); + } + } +} diff --git a/src/Examples/OpenApiNSwagClientExample/OpenApiNSwagClientExample.csproj b/src/Examples/OpenApiNSwagClientExample/OpenApiNSwagClientExample.csproj new file mode 100644 index 0000000000..c30833a39a --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/OpenApiNSwagClientExample.csproj @@ -0,0 +1,31 @@ + + + + net9.0 + + + + + + + + + + + + + + + + + + + + ExampleApi + $(MSBuildProjectName) + %(Name)Client + %(ClassName).cs + true + + + diff --git a/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs b/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs new file mode 100644 index 0000000000..0a870d7682 --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/PeopleMessageFormatter.cs @@ -0,0 +1,66 @@ +using System.Text; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Client.NSwag; + +namespace OpenApiNSwagClientExample; + +/// +/// Prints the specified people, their assigned todo-items, and its tags. +/// +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class PeopleMessageFormatter +{ + public static void PrintPeople(ApiResponse peopleResponse) + { + string message = WritePeople(peopleResponse); + Console.WriteLine(message); + } + + private static string WritePeople(ApiResponse peopleResponse) + { + if (peopleResponse.Result == null) + { + return $"Status code {peopleResponse.StatusCode} was returned without a response body."; + } + + var builder = new StringBuilder(); + builder.AppendLine($"Found {peopleResponse.Result.Data.Count} people:"); + + foreach (DataInPersonResponse person in peopleResponse.Result.Data) + { + WritePerson(person, peopleResponse.Result.Included ?? [], builder); + } + + return builder.ToString(); + } + + private static void WritePerson(DataInPersonResponse person, ICollection includes, StringBuilder builder) + { + ICollection assignedTodoItems = person.Relationships?.AssignedTodoItems?.Data ?? []; + + builder.AppendLine($" Person {person.Id}: {person.Attributes?.DisplayName} with {assignedTodoItems.Count} assigned todo-items:"); + WriteRelatedTodoItems(assignedTodoItems, includes, builder); + } + + private static void WriteRelatedTodoItems(IEnumerable todoItemIdentifiers, ICollection includes, + StringBuilder builder) + { + foreach (TodoItemIdentifierInResponse todoItemIdentifier in todoItemIdentifiers) + { + DataInTodoItemResponse includedTodoItem = includes.OfType().Single(include => include.Id == todoItemIdentifier.Id); + ICollection tags = includedTodoItem.Relationships?.Tags?.Data ?? []; + + builder.AppendLine($" TodoItem {includedTodoItem.Id}: {includedTodoItem.Attributes?.Description} with {tags.Count} tags:"); + WriteRelatedTags(tags, includes, builder); + } + } + + private static void WriteRelatedTags(IEnumerable tagIdentifiers, ICollection includes, StringBuilder builder) + { + foreach (TagIdentifierInResponse tagIdentifier in tagIdentifiers) + { + DataInTagResponse includedTag = includes.OfType().Single(include => include.Id == tagIdentifier.Id); + builder.AppendLine($" Tag {includedTag.Id}: {includedTag.Attributes?.Name}"); + } + } +} diff --git a/src/Examples/OpenApiNSwagClientExample/Program.cs b/src/Examples/OpenApiNSwagClientExample/Program.cs new file mode 100644 index 0000000000..67d81a7ad1 --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/Program.cs @@ -0,0 +1,10 @@ +using OpenApiNSwagClientExample; + +HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); +builder.Services.AddLogging(options => options.ClearProviders()); +builder.Services.AddHostedService(); +builder.Services.AddSingleton(); +builder.Services.AddHttpClient().AddHttpMessageHandler(); + +IHost host = builder.Build(); +await host.RunAsync(); diff --git a/src/Examples/OpenApiNSwagClientExample/Properties/launchSettings.json b/src/Examples/OpenApiNSwagClientExample/Properties/launchSettings.json new file mode 100644 index 0000000000..afb5e5dac4 --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Kestrel": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Examples/OpenApiNSwagClientExample/Worker.cs b/src/Examples/OpenApiNSwagClientExample/Worker.cs new file mode 100644 index 0000000000..7727c88a15 --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/Worker.cs @@ -0,0 +1,171 @@ +using JsonApiDotNetCore.OpenApi.Client.NSwag; + +namespace OpenApiNSwagClientExample; + +public sealed class Worker(ExampleApiClient apiClient, IHostApplicationLifetime hostApplicationLifetime) : BackgroundService +{ + private readonly ExampleApiClient _apiClient = apiClient; + private readonly IHostApplicationLifetime _hostApplicationLifetime = hostApplicationLifetime; + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + try + { + var queryString = new Dictionary + { + ["filter"] = "has(assignedTodoItems)", + ["sort"] = "-lastName", + ["page[size]"] = "5", + ["include"] = "assignedTodoItems.tags" + }; + + ApiResponse getResponse = await GetPeopleAsync(_apiClient, queryString, null, stoppingToken); + PeopleMessageFormatter.PrintPeople(getResponse); + + string eTag = getResponse.Headers["ETag"].Single(); + ApiResponse getResponseAgain = await GetPeopleAsync(_apiClient, queryString, eTag, stoppingToken); + PeopleMessageFormatter.PrintPeople(getResponseAgain); + + await UpdatePersonAsync(stoppingToken); + + await SendOperationsRequestAsync(stoppingToken); + + await _apiClient.GetPersonAsync("999999", null, null, stoppingToken); + } + catch (ApiException exception) + { + Console.WriteLine($"JSON:API ERROR: {exception.Result.Errors.First().Detail}"); + } + catch (HttpRequestException exception) + { + Console.WriteLine($"ERROR: {exception.Message}"); + } + + _hostApplicationLifetime.StopApplication(); + } + + private static Task> GetPeopleAsync(ExampleApiClient apiClient, IDictionary queryString, + string? ifNoneMatch, CancellationToken cancellationToken) + { + return ApiResponse.TranslateAsync(async () => await apiClient.GetPersonCollectionAsync(queryString, ifNoneMatch, cancellationToken)); + } + + private async Task UpdatePersonAsync(CancellationToken cancellationToken) + { + var updatePersonRequest = new UpdatePersonRequestDocument + { + Data = new DataInUpdatePersonRequest + { + Id = "1", + // Using TrackChangesFor to send "firstName: null" instead of omitting it. + Attributes = new TrackChangesFor(_apiClient) + { + Initializer = + { + FirstName = null, + LastName = "Doe" + } + }.Initializer + } + }; + + await ApiResponse.TranslateAsync(async () => + await _apiClient.PatchPersonAsync(updatePersonRequest.Data.Id, updatePersonRequest, cancellationToken: cancellationToken)); + } + + private async Task SendOperationsRequestAsync(CancellationToken cancellationToken) + { + var operationsRequest = new OperationsRequestDocument + { + Atomic_operations = + [ + new CreateTagOperation + { + Data = new DataInCreateTagRequest + { + Lid = "new-tag", + Attributes = new AttributesInCreateTagRequest + { + Name = "Housekeeping" + } + } + }, + new CreatePersonOperation + { + Data = new DataInCreatePersonRequest + { + Lid = "new-person", + Attributes = new AttributesInCreatePersonRequest + { + FirstName = "Cinderella", + LastName = "Tremaine" + } + } + }, + new UpdatePersonOperation + { + Data = new DataInUpdatePersonRequest + { + Lid = "new-person", + // Using TrackChangesFor to send "firstName: null" instead of omitting it. + Attributes = new TrackChangesFor(_apiClient) + { + Initializer = + { + FirstName = null + } + }.Initializer + } + }, + new CreateTodoItemOperation + { + Data = new DataInCreateTodoItemRequest + { + Lid = "new-todo-item", + Attributes = new AttributesInCreateTodoItemRequest + { + Description = "Put out the garbage", + Priority = TodoItemPriority.Medium + }, + Relationships = new RelationshipsInCreateTodoItemRequest + { + Owner = new ToOnePersonInRequest + { + Data = new PersonIdentifierInRequest + { + Lid = "new-person" + } + }, + Tags = new ToManyTagInRequest + { + Data = + [ + new TagIdentifierInRequest + { + Lid = "new-tag" + } + ] + } + } + } + }, + new UpdateTodoItemAssigneeRelationshipOperation + { + Ref = new TodoItemAssigneeRelationshipIdentifier + { + Lid = "new-todo-item" + }, + Data = new PersonIdentifierInRequest + { + Lid = "new-person" + } + } + ] + }; + + ApiResponse operationsResponse = await _apiClient.PostOperationsAsync(operationsRequest, cancellationToken); + + var newTodoItem = (DataInTodoItemResponse)operationsResponse.Result.Atomic_results.ElementAt(3).Data!; + Console.WriteLine($"Created todo-item with ID {newTodoItem.Id}: {newTodoItem.Attributes!.Description}."); + } +} diff --git a/src/Examples/OpenApiNSwagClientExample/appsettings.json b/src/Examples/OpenApiNSwagClientExample/appsettings.json new file mode 100644 index 0000000000..2b94cdb46d --- /dev/null +++ b/src/Examples/OpenApiNSwagClientExample/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Information", + "System.Net.Http.HttpClient": "Information" + } + } +} diff --git a/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj b/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj index 755299c79a..765c4231d7 100644 --- a/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj +++ b/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj @@ -9,7 +9,6 @@ - $(JsonApiDotNetCoreVersionPrefix) jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api Annotations for JsonApiDotNetCore, a framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core. json-api-dotnet diff --git a/src/JsonApiDotNetCore.Annotations/Properties/AssemblyInfo.cs b/src/JsonApiDotNetCore.Annotations/Properties/AssemblyInfo.cs index a715457d54..b4ac4b1e8d 100644 --- a/src/JsonApiDotNetCore.Annotations/Properties/AssemblyInfo.cs +++ b/src/JsonApiDotNetCore.Annotations/Properties/AssemblyInfo.cs @@ -3,6 +3,7 @@ [assembly: InternalsVisibleTo("DapperExample")] [assembly: InternalsVisibleTo("Benchmarks")] [assembly: InternalsVisibleTo("JsonApiDotNetCore")] +[assembly: InternalsVisibleTo("JsonApiDotNetCore.OpenApi.Swashbuckle")] [assembly: InternalsVisibleTo("JsonApiDotNetCoreTests")] [assembly: InternalsVisibleTo("UnitTests")] [assembly: InternalsVisibleTo("TestBuildingBlocks")] diff --git a/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.props b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.props new file mode 100644 index 0000000000..10a3fc585b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.props @@ -0,0 +1,49 @@ + + + + + --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Warning --disable-validation-rules KnownAndNotSupportedFormats,InconsistentTypeFormatPair + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.targets b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.targets new file mode 100644 index 0000000000..72b32aa7a5 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/Build/JsonApiDotNetCore.OpenApi.Client.Kiota.targets @@ -0,0 +1,189 @@ + + + + + + + + + (?:\r\n|\n|\r)(#pragma|using)", RegexOptions.Singleline | RegexOptions.Compiled); + private static readonly Regex NullableRegex = new(@"(?s)#if NETSTANDARD2_1_OR_GREATER .*?(?:\r\n|\n|\r)#nullable enable(?:\r\n|\n|\r)(?.*?)(?:\r\n|\n|\r)#nullable restore(?:\r\n|\n|\r)#else(?:\r\n|\n|\r)(?.*?)(?:\r\n|\n|\r)#endif", RegexOptions.Singleline | RegexOptions.Compiled); + private static readonly Regex LineBreaksRegex = new(@"}(?:\r\n|\n|\r)(?[ ]+/// )", RegexOptions.Singleline | RegexOptions.Compiled); + + public string StartDirectory { get; set; } + + public override bool Execute() + { + string absoluteStartDirectory = Path.GetFullPath(StartDirectory); + Log.LogMessage(MessageImportance.High, $"Patching kiota output files in {absoluteStartDirectory}"); + + foreach (string path in Directory.GetFiles(absoluteStartDirectory, "*.cs", SearchOption.AllDirectories)) + { + string content = File.ReadAllText(path); + content = HeaderRegex.Replace(content, $"// {Environment.NewLine}#nullable enable{Environment.NewLine}#pragma warning disable CS8625{Environment.NewLine}$1"); + content = NullableRegex.Replace(content, "$1"); + content = LineBreaksRegex.Replace(content, $"}}{Environment.NewLine}{Environment.NewLine}$1"); + + File.WriteAllText(path, content); + Log.LogMessage(MessageImportance.Normal, $"Patched file: {path}"); + } + + return true; + } + } + ]]> + + + + + + + + + + + + + + %(Arguments) --openapi %(Identity) + + + %(Arguments) --language %(Language) + + + %(Arguments) --language csharp + + + %(Arguments) --class-name %(ClassName) + + + %(Arguments) --namespace-name %(NamespaceName) + + + %(Arguments) --output %(OutputPath) + <_NonEmptyOutputPath>%(OutputPath) + + + <_NonEmptyOutputPath>./output + + + %(Arguments) --log-level %(LogLevel) + + + %(Arguments) --backing-store + + + %(Arguments) --exclude-backward-compatible + + + %(Arguments) --additional-data %(AdditionalData) + + + %(Arguments) --serializer %(Serializer) + + + %(Arguments) --deserializer %(Deserializer) + + + %(Arguments) --clean-output + + + %(Arguments) --clear-cache + + + %(Arguments) --structured-mime-types %(MimeTypes) + + + %(Arguments) --include-path %(IncludePath) + + + %(Arguments) --exclude-path %(ExcludePath) + + + %(Arguments) --disable-validation-rules %(DisableValidationRules) + + + %(Arguments) --disable-ssl-validation + + + %(Arguments) --type-access-modifier %(TypeAccessModifier) + + + %(Arguments) %(ExtraArguments) + + + + + + + + <_WildcardGroup Include="%2A%2A/%2A.cs"> + %(KiotaReference._NonEmptyOutputPath) + + + + + + + + + <_RelativeExcludePathGroup Include="@(_FilesToExcludeGroup)" Condition="'@(_FilesToExcludeGroup)' != ''"> + + $([MSBuild]::MakeRelative($(MSBuildProjectDirectory), %(_FilesToExcludeGroup.FullPath))) + + + + + + + + + + + + <_WildcardGroup Include="%2A%2A/%2A.cs"> + %(KiotaReference._NonEmptyOutputPath) + + + + + + + + + <_RelativeIncludePathGroup Include="@(_FilesToIncludeGroup)"> + + $([MSBuild]::MakeRelative($(MSBuildProjectDirectory), %(_FilesToIncludeGroup.FullPath))) + + + + + + + + + + + + <_KiotaCommand Condition="'$(KiotaAutoRestoreTools)' == 'true'">dotnet kiota generate + <_KiotaCommand Condition="'$(KiotaAutoRestoreTools)' != 'true'">kiota generate + + + + + + + + diff --git a/src/JsonApiDotNetCore.OpenApi.Client.Kiota/JsonApiDotNetCore.OpenApi.Client.Kiota.csproj b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/JsonApiDotNetCore.OpenApi.Client.Kiota.csproj new file mode 100644 index 0000000000..640b949477 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/JsonApiDotNetCore.OpenApi.Client.Kiota.csproj @@ -0,0 +1,42 @@ + + + net8.0 + true + true + false + $(NoWarn);NU5110;NU5111 + + + + + + $(VersionPrefix)-preview.$(OpenApiPreviewNumber) + jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api;openapi;swagger;client;kiota + Provides OpenAPI support for JSON:API generated clients using Kiota. + json-api-dotnet + https://www.jsonapi.net/ + MIT + false + See https://github.com/json-api-dotnet/JsonApiDotNetCore/releases. + package-icon.png + PackageReadme.md + true + embedded + + + + + + + + + + + + + + + + + + diff --git a/src/JsonApiDotNetCore.OpenApi.Client.Kiota/SetQueryStringHttpMessageHandler.cs b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/SetQueryStringHttpMessageHandler.cs new file mode 100644 index 0000000000..fd088fb956 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.Kiota/SetQueryStringHttpMessageHandler.cs @@ -0,0 +1,57 @@ +using JetBrains.Annotations; +using Microsoft.AspNetCore.WebUtilities; + +namespace JsonApiDotNetCore.OpenApi.Client.Kiota; + +/// +/// Enables setting the HTTP query string. Workaround for https://github.com/microsoft/kiota/issues/3800. +/// +[PublicAPI] +public sealed class SetQueryStringHttpMessageHandler : DelegatingHandler +{ + private IDictionary? _queryString; + + public IDisposable CreateScope(IDictionary queryString) + { + ArgumentNullException.ThrowIfNull(queryString); + + return new QueryStringScope(this, queryString); + } + + protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + ArgumentNullException.ThrowIfNull(request); + + if (_queryString is { Count: > 0 } && request.RequestUri != null) + { + request.RequestUri = new Uri(QueryHelpers.AddQueryString(request.RequestUri.ToString(), _queryString)); + } + + return base.SendAsync(request, cancellationToken); + } + + private sealed class QueryStringScope : IDisposable + { + private readonly SetQueryStringHttpMessageHandler _owner; + private readonly IDictionary? _backupQueryString; + + public QueryStringScope(SetQueryStringHttpMessageHandler owner, IDictionary queryString) + { + _owner = owner; + _backupQueryString = owner._queryString; + + owner._queryString = SetEmptyStringForNullValues(queryString); + } + + private static Dictionary SetEmptyStringForNullValues(IDictionary queryString) + { + // QueryHelpers.AddQueryString ignores null values, so replace them with empty strings to get them sent. + return queryString.ToDictionary(pair => pair.Key, pair => pair.Value ?? (string?)string.Empty); + } + + public void Dispose() + { + _owner._queryString = _backupQueryString; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiException.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiException.cs new file mode 100644 index 0000000000..8b66839e9e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiException.cs @@ -0,0 +1,24 @@ +using JetBrains.Annotations; + +// We cannot rely on generating ApiException as soon as we are generating multiple clients, see https://github.com/RicoSuter/NSwag/issues/2839#issuecomment-776647377. +// Instead, we configure NSwag to point to the exception below in the generated code. + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public class ApiException(string message, int statusCode, string? response, IReadOnlyDictionary> headers, Exception? innerException) + : Exception($"HTTP {statusCode}: {message}", innerException) +{ + public int StatusCode { get; } = statusCode; + public virtual string? Response { get; } = string.IsNullOrEmpty(response) ? null : response; + public IReadOnlyDictionary> Headers { get; } = headers; +} + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ApiException( + string message, int statusCode, string? response, IReadOnlyDictionary> headers, TResult result, Exception? innerException) + : ApiException(message, statusCode, response, headers, innerException) +{ + public TResult Result { get; } = result; + public override string Response => $"The response body is unavailable. Use the {nameof(Result)} property instead."; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiResponse.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiResponse.cs new file mode 100644 index 0000000000..74ee77127f --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiResponse.cs @@ -0,0 +1,79 @@ +using System.Net; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +[PublicAPI] +public class ApiResponse(int statusCode, IReadOnlyDictionary> headers) +{ + public int StatusCode { get; private set; } = statusCode; + public IReadOnlyDictionary> Headers { get; private set; } = headers; + + public static async Task TranslateAsync(Func> operation) + where TResponse : class + { + ArgumentNullException.ThrowIfNull(operation); + + try + { + return await operation().ConfigureAwait(false); + } + catch (ApiException exception) when (exception.StatusCode is (int)HttpStatusCode.NoContent or (int)HttpStatusCode.NotModified) + { + // Workaround for https://github.com/RicoSuter/NSwag/issues/2499 + return null; + } + } + + public static async Task TranslateAsync(Func operation) + { + ArgumentNullException.ThrowIfNull(operation); + + try + { + await operation().ConfigureAwait(false); + } + catch (ApiException exception) when (exception.StatusCode is (int)HttpStatusCode.NoContent or (int)HttpStatusCode.NotModified) + { + // Workaround for https://github.com/RicoSuter/NSwag/issues/2499 + } + } + + public static async Task> TranslateAsync(Func>> operation) + where TResult : class + { + ArgumentNullException.ThrowIfNull(operation); + + try + { + return (await operation().ConfigureAwait(false))!; + } + catch (ApiException exception) when (exception.StatusCode is (int)HttpStatusCode.NoContent or (int)HttpStatusCode.NotModified) + { + // Workaround for https://github.com/RicoSuter/NSwag/issues/2499 + return new ApiResponse(exception.StatusCode, exception.Headers, null); + } + } + + public static async Task TranslateAsync(Func> operation) + { + ArgumentNullException.ThrowIfNull(operation); + + try + { + return await operation().ConfigureAwait(false); + } + catch (ApiException exception) when (exception.StatusCode is (int)HttpStatusCode.NoContent or (int)HttpStatusCode.NotModified) + { + // Workaround for https://github.com/RicoSuter/NSwag/issues/2499 + return new ApiResponse(exception.StatusCode, exception.Headers); + } + } +} + +[PublicAPI] +public class ApiResponse(int statusCode, IReadOnlyDictionary> headers, TResult result) + : ApiResponse(statusCode, headers) +{ + public TResult Result { get; private set; } = result; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/BlockedJsonInheritanceConverter.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/BlockedJsonInheritanceConverter.cs new file mode 100644 index 0000000000..a3a7e627db --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/BlockedJsonInheritanceConverter.cs @@ -0,0 +1,43 @@ +using JetBrains.Annotations; +using Newtonsoft.Json; + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +// Referenced from liquid template, to ensure the built-in JsonInheritanceConverter from NSwag is never used. +[PublicAPI] +public abstract class BlockedJsonInheritanceConverter : JsonConverter +{ + private const string DefaultDiscriminatorName = "discriminator"; + + public string DiscriminatorName { get; } + + public override bool CanWrite => true; + public override bool CanRead => true; + + protected BlockedJsonInheritanceConverter() + : this(DefaultDiscriminatorName) + { + } + + protected BlockedJsonInheritanceConverter(string discriminatorName) + { + ArgumentException.ThrowIfNullOrEmpty(discriminatorName); + + DiscriminatorName = discriminatorName; + } + + public override bool CanConvert(Type objectType) + { + return true; + } + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + throw new InvalidOperationException("JsonInheritanceConverter is incompatible with JSON:API and must not be used."); + } + + public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + throw new InvalidOperationException("JsonInheritanceConverter is incompatible with JSON:API and must not be used."); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Build/JsonApiDotNetCore.OpenApi.Client.NSwag.props b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Build/JsonApiDotNetCore.OpenApi.Client.NSwag.props new file mode 100644 index 0000000000..cc65a6ac4a --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Build/JsonApiDotNetCore.OpenApi.Client.NSwag.props @@ -0,0 +1,15 @@ + + + NSwagCSharp + false + false + ApiResponse + JsonApiDotNetCore.OpenApi.Client.NSwag + true + true + true + JsonApiDotNetCore.OpenApi.Client.NSwag.JsonApiClient + Prism + $(MSBuildThisFileDirectory)../Templates + + diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/IJsonApiClient.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/IJsonApiClient.cs new file mode 100644 index 0000000000..df6a35d78e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/IJsonApiClient.cs @@ -0,0 +1,41 @@ +using System.Linq.Expressions; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +[PublicAPI] +public interface IJsonApiClient +{ + /// + /// Ensures correct serialization of JSON:API attributes in the request body of a POST/PATCH request at a resource endpoint. Properties with default + /// values are omitted, unless explicitly included using + /// + /// In JSON:API, an omitted attribute indicates to ignore it, while an attribute that is set to null means to clear it. This poses a problem, + /// because the serializer cannot distinguish between "you have explicitly set this .NET property to its default value" vs "you didn't touch it, so it + /// contains its default value" when converting to JSON. + /// + /// + /// + /// The request document instance for which default values should be omitted. + /// + /// + /// Optional. A list of lambda expressions that indicate which properties to always include in the JSON request body. For example: + /// video.Title, video => video.Summary + /// ]]> + /// + /// + /// The type of the request document. + /// + /// + /// The type of the attributes object inside . + /// + /// + /// An to clear the current registration. For efficient memory usage, it is recommended to wrap calls to this method in a + /// using statement, so the registrations are cleaned up after executing the request. After disposal, the client can be reused without the + /// registrations added earlier. + /// + IDisposable WithPartialAttributeSerialization(TRequestDocument requestDocument, + params Expression>[] alwaysIncludedAttributeSelectors) + where TRequestDocument : class; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiClient.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiClient.cs new file mode 100644 index 0000000000..14cf54825d --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiClient.cs @@ -0,0 +1,458 @@ +using System.ComponentModel; +using System.Reflection; +using JetBrains.Annotations; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +/// +/// Base class to inherit auto-generated NSwag OpenAPI clients from. Provides support for partial POST/PATCH in JSON:API requests, optionally combined +/// with OpenAPI inheritance. +/// +[PublicAPI] +public abstract class JsonApiClient +{ + private const string GeneratedJsonInheritanceConverterName = "JsonInheritanceConverter"; + private static readonly DefaultContractResolver UnmodifiedContractResolver = new(); + + private readonly Dictionary> _propertyStore = []; + + /// + /// Whether to automatically clear tracked properties after sending a request. Default value: true. Set to false to reuse tracked + /// properties for multiple requests and call after the last request to clean up. + /// + public bool AutoClearTracked { get; set; } = true; + + internal void Track(T container) + where T : INotifyPropertyChanged, new() + { + container.PropertyChanged += ContainerOnPropertyChanged; + + MarkAsTracked(container); + } + + private void ContainerOnPropertyChanged(object? sender, PropertyChangedEventArgs args) + { + if (sender is INotifyPropertyChanged container && args.PropertyName != null) + { + MarkAsTracked(container, args.PropertyName); + } + } + + /// + /// Marks the specified properties on an object instance as tracked. Use this when unable to use inline initializer syntax for tracking. + /// + /// + /// The object instance whose properties to mark as tracked. + /// + /// + /// The names of the properties to mark as tracked. Properties in this list are always included. Any other property is only included if its value differs + /// from the property type's default value. + /// + public void MarkAsTracked(INotifyPropertyChanged container, params string[] propertyNames) + { + ArgumentNullException.ThrowIfNull(container); + ArgumentNullException.ThrowIfNull(propertyNames); + + if (!_propertyStore.TryGetValue(container, out ISet? properties)) + { + properties = new HashSet(); + _propertyStore[container] = properties; + } + + foreach (string propertyName in propertyNames) + { + properties.Add(propertyName); + } + } + + /// + /// Clears all tracked properties. Call this after sending multiple requests when is set to false. + /// + public void ClearAllTracked() + { + foreach (INotifyPropertyChanged container in _propertyStore.Keys) + { + container.PropertyChanged -= ContainerOnPropertyChanged; + } + + _propertyStore.Clear(); + } + + private void RemoveContainer(INotifyPropertyChanged container) + { + container.PropertyChanged -= ContainerOnPropertyChanged; + _propertyStore.Remove(container); + } + + /// + /// Initial setup. Call this from the Initialize partial method in the auto-generated NSwag client. + /// + /// + /// The to configure. + /// + /// + /// CAUTION: Calling this method makes the serializer stateful, which removes thread-safety of the owning auto-generated NSwag client. As a result, the + /// client MUST NOT be shared. So don't use a static instance, and don't register as a singleton in the service container. Also, do not execute parallel + /// requests on the same NSwag client instance. Executing multiple sequential requests on the same generated client instance is fine. + /// + protected void SetSerializerSettingsForJsonApi(JsonSerializerSettings serializerSettings) + { + ArgumentNullException.ThrowIfNull(serializerSettings); + + serializerSettings.ContractResolver = new InsertDiscriminatorPropertyContractResolver(); + serializerSettings.Converters.Insert(0, new PropertyTrackingInheritanceConverter(this)); + } + + private static string? GetDiscriminatorName(Type objectType) + { + JsonContract contract = UnmodifiedContractResolver.ResolveContract(objectType); + + if (contract.Converter != null && contract.Converter.GetType().Name == GeneratedJsonInheritanceConverterName) + { + var inheritanceConverter = (BlockedJsonInheritanceConverter)contract.Converter; + return inheritanceConverter.DiscriminatorName; + } + + return null; + } + + /// + /// Replacement for the writing part of client-generated JsonInheritanceConverter that doesn't block other converters and preserves the JSON path on + /// error. + /// + private class InsertDiscriminatorPropertyContractResolver : DefaultContractResolver + { + protected override JsonObjectContract CreateObjectContract(Type objectType) + { + // NSwag adds [JsonConverter(typeof(JsonInheritanceConverter), "type")] on types to write the discriminator. + // This annotation has higher precedence over converters in the serializer settings, which is why ours normally won't execute. + // Once we tell Newtonsoft to ignore JsonInheritanceConverter, our converter can kick in. + + JsonObjectContract contract = base.CreateObjectContract(objectType); + + if (contract.Converter != null && contract.Converter.GetType().Name == GeneratedJsonInheritanceConverterName) + { + contract.Converter = null; + } + + return contract; + } + + protected override IList CreateProperties(Type type, MemberSerialization memberSerialization) + { + IList properties = base.CreateProperties(type, memberSerialization); + + string? discriminatorName = GetDiscriminatorName(type); + + if (discriminatorName != null) + { + JsonProperty discriminatorProperty = CreateDiscriminatorProperty(discriminatorName, type); + properties.Insert(0, discriminatorProperty); + } + + return properties; + } + + private static JsonProperty CreateDiscriminatorProperty(string discriminatorName, Type declaringType) + { + return new JsonProperty + { + PropertyName = discriminatorName, + PropertyType = typeof(string), + DeclaringType = declaringType, + ValueProvider = new DiscriminatorValueProvider(), + Readable = true, + Writable = true + }; + } + + private sealed class DiscriminatorValueProvider : IValueProvider + { + public object? GetValue(object target) + { + Type type = target.GetType(); + + foreach (Attribute attribute in type.GetCustomAttributes(true)) + { + var shim = JsonInheritanceAttributeShim.TryCreate(attribute); + + if (shim != null && shim.Type == type) + { + return shim.Key; + } + } + + return null; + } + + public void SetValue(object target, object? value) + { + // Nothing to do, NSwag doesn't generate a property for the discriminator. + } + } + } + + /// + /// Provides support for writing partial POST/PATCH in JSON:API requests via tracked properties. Provides reading of discriminator for inheritance. + /// + private sealed class PropertyTrackingInheritanceConverter : JsonConverter + { + [ThreadStatic] + private static bool _isWriting; + + [ThreadStatic] + private static bool _isReading; + + private readonly JsonApiClient _apiClient; + + public override bool CanRead + { + get + { + if (_isReading) + { + // Prevent infinite recursion, but auto-reset so we'll participate in nested objects. + _isReading = false; + return false; + } + + return true; + } + } + + public override bool CanWrite + { + get + { + if (_isWriting) + { + // Prevent infinite recursion, but auto-reset so we'll participate in nested objects. + _isWriting = false; + return false; + } + + return true; + } + } + + public PropertyTrackingInheritanceConverter(JsonApiClient apiClient) + { + ArgumentNullException.ThrowIfNull(apiClient); + + _apiClient = apiClient; + } + + public override bool CanConvert(Type objectType) + { + // Because this is called BEFORE CanRead/CanWrite, respond to both tracking and inheritance. + // We don't actually write for inheritance, so bail out later if that's the case. + + if (_apiClient._propertyStore.Keys.Any(containingType => containingType.GetType() == objectType)) + { + return true; + } + + var converterAttribute = objectType.GetCustomAttribute(true); + return converterAttribute is { ConverterType.Name: GeneratedJsonInheritanceConverterName }; + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + _isReading = true; + + try + { + JToken token = JToken.ReadFrom(reader); + string? discriminatorValue = GetDiscriminatorValue(objectType, token); + + Type resolvedType = ResolveTypeFromDiscriminatorValue(objectType, discriminatorValue); + return token.ToObject(resolvedType, serializer); + } + finally + { + _isReading = false; + } + } + + private static string? GetDiscriminatorValue(Type objectType, JToken token) + { + var jsonConverterAttribute = objectType.GetCustomAttribute(true)!; + + if (jsonConverterAttribute.ConverterParameters is not [string]) + { + throw new JsonException($"Expected single 'type' parameter for JsonInheritanceConverter usage on type '{objectType}'."); + } + + string discriminatorName = (string)jsonConverterAttribute.ConverterParameters[0]; + return token.Children().FirstOrDefault(property => property.Name == discriminatorName)?.Value.ToString(); + } + + private static Type ResolveTypeFromDiscriminatorValue(Type objectType, string? discriminatorValue) + { + if (discriminatorValue != null) + { + foreach (Attribute attribute in objectType.GetCustomAttributes(true)) + { + var shim = JsonInheritanceAttributeShim.TryCreate(attribute); + + if (shim != null && shim.Key == discriminatorValue) + { + return shim.Type; + } + } + } + + return objectType; + } + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + _isWriting = true; + + try + { + if (value is INotifyPropertyChanged container && _apiClient._propertyStore.TryGetValue(container, out ISet? properties)) + { + // Because we're overwriting NullValueHandling/DefaultValueHandling, we miss out on some validations that Newtonsoft would otherwise run. + AssertRequiredTrackedPropertiesHaveNoDefaultValue(container, properties, writer.Path); + + IContractResolver backupContractResolver = serializer.ContractResolver; + + try + { + // Caution: Swapping the contract resolver is not safe for concurrent usage, yet it needs to know the tracked instance. + serializer.ContractResolver = new PropertyTrackingContractResolver(container, properties); + serializer.Serialize(writer, value); + + if (_apiClient.AutoClearTracked) + { + _apiClient.RemoveContainer(container); + } + } + finally + { + serializer.ContractResolver = backupContractResolver; + } + } + else + { + // We get here when the type is tracked, but not this instance. Or when writing for inheritance. + serializer.Serialize(writer, value); + } + } + finally + { + _isWriting = false; + } + } + + private static void AssertRequiredTrackedPropertiesHaveNoDefaultValue(object container, ISet properties, string jsonPath) + { + foreach (PropertyInfo propertyInfo in container.GetType().GetProperties()) + { + bool isTracked = properties.Contains(propertyInfo.Name); + + if (!isTracked) + { + AssertPropertyHasNonDefaultValueIfRequired(container, propertyInfo, jsonPath); + } + } + } + + private static void AssertPropertyHasNonDefaultValueIfRequired(object attributesObject, PropertyInfo propertyInfo, string jsonPath) + { + var jsonProperty = propertyInfo.GetCustomAttribute(); + + if (jsonProperty is { Required: Required.Always or Required.AllowNull }) + { + if (PropertyHasDefaultValue(propertyInfo, attributesObject)) + { + throw new JsonSerializationException( + $"Cannot write a default value for property '{jsonProperty.PropertyName}'. Property requires a non-default value. Path '{jsonPath}'.", + jsonPath, 0, 0, null); + } + } + } + + private static bool PropertyHasDefaultValue(PropertyInfo propertyInfo, object instance) + { + object? propertyValue = propertyInfo.GetValue(instance); + object? defaultValue = GetDefaultValue(propertyInfo.PropertyType); + + return EqualityComparer.Default.Equals(propertyValue, defaultValue); + } + + private static object? GetDefaultValue(Type type) + { + return type.IsValueType ? Activator.CreateInstance(type) : null; + } + } + + /// + /// Overrules the and annotations on generated properties for tracked object + /// instances to support JSON:API partial POST/PATCH. + /// + private sealed class PropertyTrackingContractResolver : InsertDiscriminatorPropertyContractResolver + { + private readonly INotifyPropertyChanged _container; + private readonly ISet _properties; + + public PropertyTrackingContractResolver(INotifyPropertyChanged container, ISet properties) + { + ArgumentNullException.ThrowIfNull(container); + ArgumentNullException.ThrowIfNull(properties); + + _container = container; + _properties = properties; + } + + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + JsonProperty jsonProperty = base.CreateProperty(member, memberSerialization); + + if (jsonProperty.DeclaringType == _container.GetType()) + { + if (_properties.Contains(jsonProperty.UnderlyingName!)) + { + jsonProperty.NullValueHandling = NullValueHandling.Include; + jsonProperty.DefaultValueHandling = DefaultValueHandling.Include; + } + else + { + jsonProperty.NullValueHandling = NullValueHandling.Ignore; + jsonProperty.DefaultValueHandling = DefaultValueHandling.Ignore; + } + } + + return jsonProperty; + } + } + + private sealed class JsonInheritanceAttributeShim + { + private readonly Attribute _instance; + private readonly PropertyInfo _keyProperty; + private readonly PropertyInfo _typeProperty; + + public string Key => (string)_keyProperty.GetValue(_instance)!; + public Type Type => (Type)_typeProperty.GetValue(_instance)!; + + private JsonInheritanceAttributeShim(Attribute instance, Type type) + { + _instance = instance; + _keyProperty = type.GetProperty("Key") ?? throw new ArgumentException("Key property not found.", nameof(instance)); + _typeProperty = type.GetProperty("Type") ?? throw new ArgumentException("Type property not found.", nameof(instance)); + } + + public static JsonInheritanceAttributeShim? TryCreate(Attribute attribute) + { + ArgumentNullException.ThrowIfNull(attribute); + + Type type = attribute.GetType(); + return type.Name == "JsonInheritanceAttribute" ? new JsonInheritanceAttributeShim(attribute, type) : null; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiDotNetCore.OpenApi.Client.NSwag.csproj b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiDotNetCore.OpenApi.Client.NSwag.csproj new file mode 100644 index 0000000000..20e2306730 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiDotNetCore.OpenApi.Client.NSwag.csproj @@ -0,0 +1,37 @@ + + + net8.0 + true + true + false + + + + + + $(VersionPrefix)-preview.$(OpenApiPreviewNumber) + jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api;openapi;swagger;client;nswag + Provides OpenAPI support for JSON:API generated clients using NSwag. + json-api-dotnet + https://www.jsonapi.net/ + MIT + false + See https://github.com/json-api-dotnet/JsonApiDotNetCore/releases. + package-icon.png + PackageReadme.md + true + embedded + + + + + + + + + + + + + + diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/NotifyPropertySet.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/NotifyPropertySet.cs new file mode 100644 index 0000000000..80adb56477 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/NotifyPropertySet.cs @@ -0,0 +1,72 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using JetBrains.Annotations; + +// Adapted from https://github.com/PrismLibrary/Prism/blob/9.0.537/src/Prism.Core/Mvvm/BindableBase.cs for JsonApiDotNetCore. + +#pragma warning disable AV1553 // Do not use optional parameters with default value null for strings, collections or tasks +#pragma warning disable AV1554 // Method contains optional parameter in type hierarchy +#pragma warning disable AV1562 // Do not declare a parameter as ref or out + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +/// +/// Implementation of that doesn't detect changes. +/// +[PublicAPI] +public abstract class NotifyPropertySet : INotifyPropertyChanged +{ + /// + /// Occurs when a property is set. + /// + public event PropertyChangedEventHandler? PropertyChanged; + + /// + /// Sets the property and notifies listeners. + /// + /// + /// Type of the property. + /// + /// + /// Reference to a property with both getter and setter. + /// + /// + /// Desired value for the property. + /// + /// + /// Name of the property used to notify listeners. This value is optional and can be provided automatically when invoked from compilers that support + /// CallerMemberName. + /// + /// + /// Always true. + /// + protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string? propertyName = null) + { + storage = value; + RaisePropertyChanged(propertyName); + return true; + } + + /// + /// Raises this object's PropertyChanged event. + /// + /// + /// Name of the property used to notify listeners. This value is optional and can be provided automatically when invoked from compilers that support + /// . + /// + protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null) + { + OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); + } + + /// + /// Raises this object's PropertyChanged event. + /// + /// + /// The . + /// + protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) + { + PropertyChanged?.Invoke(this, args); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Properties/AssemblyInfo.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1ac53bb335 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("OpenApiNSwagClientTests")] diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Class.Inheritance.liquid b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Class.Inheritance.liquid new file mode 100644 index 0000000000..1ddffc4af0 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Class.Inheritance.liquid @@ -0,0 +1,14 @@ +{% comment %} + + Adapted from https://github.com/RicoSuter/NJsonSchema/blob/v11.1.0/src/NJsonSchema.CodeGeneration.CSharp/Templates/Class.Inheritance.liquid + for JsonApiDotNetCore, to intercept when properties are set. This is needed to support partial POST/PATCH to distinguish between sending + a property with its default value versus omitting the property. + +{% endcomment %} +{%- if RenderInpc %} +{% if HasInheritance %} : {{ BaseClassName }}{% else %} : System.ComponentModel.INotifyPropertyChanged{% endif %} +{%- elsif RenderPrism %} +{% if HasInheritance %} : {{ BaseClassName }}{% else %} : JsonApiDotNetCore.OpenApi.Client.NSwag.NotifyPropertySet{% endif %} +{%- else %} +{% if HasInheritance %} : {{ BaseClassName }}{% endif %} +{%- endif %} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Client.Class.Annotations.liquid b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Client.Class.Annotations.liquid new file mode 100644 index 0000000000..bf791d968b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/Client.Class.Annotations.liquid @@ -0,0 +1,14 @@ +{% comment %} + + Adapted from https://github.com/RicoSuter/NSwag/blob/v14.2.0/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.Annotations.liquid + for JsonApiDotNetCore, to initialize the JSON serializer for use with JSON:API. + +{% endcomment %} +partial class {{ Class }} +{ + partial void Initialize() + { + _instanceSettings = new Newtonsoft.Json.JsonSerializerSettings(_settings.Value); + SetSerializerSettingsForJsonApi(_instanceSettings); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/JsonInheritanceConverter.liquid b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/JsonInheritanceConverter.liquid new file mode 100644 index 0000000000..e524f3e1f7 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/Templates/JsonInheritanceConverter.liquid @@ -0,0 +1,19 @@ +{% comment %} + + Adapted from https://github.com/RicoSuter/NJsonSchema/blob/v11.1.0/src/NJsonSchema.CodeGeneration.CSharp/Templates/JsonInheritanceConverter.liquid + for JsonApiDotNetCore, to provide alternate OpenAPI inheritance implementation that enables the use of third-party converters. + +{% endcomment %} +[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "{{ ToolchainVersion }}")] +public class JsonInheritanceConverter : JsonApiDotNetCore.OpenApi.Client.NSwag.BlockedJsonInheritanceConverter +{ + public JsonInheritanceConverter() + : base() + { + } + + public JsonInheritanceConverter(string discriminatorName) + : base(discriminatorName) + { + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Client.NSwag/TrackChangesFor.cs b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/TrackChangesFor.cs new file mode 100644 index 0000000000..278b10ceac --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Client.NSwag/TrackChangesFor.cs @@ -0,0 +1,23 @@ +using System.ComponentModel; + +namespace JsonApiDotNetCore.OpenApi.Client.NSwag; + +/// +/// Tracks assignment of property values, to support JSON:API partial POST/PATCH. +/// +/// +/// The type whose property assignments to track. +/// +public sealed class TrackChangesFor + where T : INotifyPropertyChanged, new() +{ + public T Initializer { get; } + + public TrackChangesFor(JsonApiClient apiClient) + { + ArgumentNullException.ThrowIfNull(apiClient); + + Initializer = new T(); + apiClient.Track(Initializer); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ActionDescriptorExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ActionDescriptorExtensions.cs new file mode 100644 index 0000000000..1892aca576 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ActionDescriptorExtensions.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using Microsoft.AspNetCore.Mvc.Abstractions; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class ActionDescriptorExtensions +{ + public static MethodInfo GetActionMethod(this ActionDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return ((ControllerActionDescriptor)descriptor).MethodInfo; + } + + public static TFilterMetaData? GetFilterMetadata(this ActionDescriptor descriptor) + where TFilterMetaData : IFilterMetadata + { + ArgumentNullException.ThrowIfNull(descriptor); + + return descriptor.FilterDescriptors.Select(filterDescriptor => filterDescriptor.Filter).OfType().FirstOrDefault(); + } + + public static ControllerParameterDescriptor? GetBodyParameterDescriptor(this ActionDescriptor descriptor) + { + ArgumentNullException.ThrowIfNull(descriptor); + + return (ControllerParameterDescriptor?)descriptor.Parameters.FirstOrDefault(parameterDescriptor => + parameterDescriptor.BindingInfo?.BindingSource == BindingSource.Body); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs new file mode 100644 index 0000000000..e1e04a2464 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureMvcOptions.cs @@ -0,0 +1,50 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class ConfigureMvcOptions : IConfigureOptions +{ + private readonly IJsonApiRoutingConvention _jsonApiRoutingConvention; + private readonly OpenApiEndpointConvention _openApiEndpointConvention; + private readonly JsonApiRequestFormatMetadataProvider _jsonApiRequestFormatMetadataProvider; + private readonly IJsonApiOptions _jsonApiOptions; + + public ConfigureMvcOptions(IJsonApiRoutingConvention jsonApiRoutingConvention, OpenApiEndpointConvention openApiEndpointConvention, + JsonApiRequestFormatMetadataProvider jsonApiRequestFormatMetadataProvider, IJsonApiOptions jsonApiOptions) + { + ArgumentNullException.ThrowIfNull(jsonApiRoutingConvention); + ArgumentNullException.ThrowIfNull(openApiEndpointConvention); + ArgumentNullException.ThrowIfNull(jsonApiRequestFormatMetadataProvider); + ArgumentNullException.ThrowIfNull(jsonApiOptions); + + _jsonApiRoutingConvention = jsonApiRoutingConvention; + _openApiEndpointConvention = openApiEndpointConvention; + _jsonApiRequestFormatMetadataProvider = jsonApiRequestFormatMetadataProvider; + _jsonApiOptions = jsonApiOptions; + } + + public void Configure(MvcOptions options) + { + ArgumentNullException.ThrowIfNull(options); + + AddSwashbuckleCliCompatibility(options); + + options.InputFormatters.Add(_jsonApiRequestFormatMetadataProvider); + options.Conventions.Add(_openApiEndpointConvention); + + ((JsonApiOptions)_jsonApiOptions).IncludeExtensions(OpenApiMediaTypeExtension.OpenApi, OpenApiMediaTypeExtension.RelaxedOpenApi); + } + + private void AddSwashbuckleCliCompatibility(MvcOptions options) + { + if (!options.Conventions.Any(convention => convention is IJsonApiRoutingConvention)) + { + // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1957 for why this is needed. + options.Conventions.Insert(0, _jsonApiRoutingConvention); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs new file mode 100644 index 0000000000..f3fb5198ca --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConfigureSwaggerGenOptions.cs @@ -0,0 +1,152 @@ +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using JsonApiDotNetCore.Resources; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class ConfigureSwaggerGenOptions : IConfigureOptions +{ + private static readonly Dictionary BaseToDerivedSchemaTypes = new() + { + [typeof(IdentifierInRequest)] = typeof(IdentifierInRequest<>), + [typeof(ResourceInCreateRequest)] = typeof(DataInCreateRequest<>), + [typeof(ResourceInUpdateRequest)] = typeof(DataInUpdateRequest<>), + [typeof(ResourceInResponse)] = typeof(DataInResponse<>) + }; + + private static readonly Type[] AtomicOperationDerivedSchemaTypes = + [ + typeof(CreateOperation<>), + typeof(UpdateOperation<>), + typeof(DeleteOperation<>), + typeof(UpdateToOneRelationshipOperation<>), + typeof(UpdateToManyRelationshipOperation<>), + typeof(AddToRelationshipOperation<>), + typeof(RemoveFromRelationshipOperation<>) + ]; + + private readonly OpenApiOperationIdSelector _operationIdSelector; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + private readonly IControllerResourceMapping _controllerResourceMapping; + private readonly IResourceGraph _resourceGraph; + + public ConfigureSwaggerGenOptions(OpenApiOperationIdSelector operationIdSelector, JsonApiSchemaIdSelector schemaIdSelector, + IControllerResourceMapping controllerResourceMapping, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(operationIdSelector); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + ArgumentNullException.ThrowIfNull(controllerResourceMapping); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _operationIdSelector = operationIdSelector; + _schemaIdSelector = schemaIdSelector; + _controllerResourceMapping = controllerResourceMapping; + _resourceGraph = resourceGraph; + } + + public void Configure(SwaggerGenOptions options) + { + ArgumentNullException.ThrowIfNull(options); + + options.SupportNonNullableReferenceTypes(); + options.UseAllOfToExtendReferenceSchemas(); + + options.UseAllOfForInheritance(); + options.SelectDiscriminatorNameUsing(_ => JsonApiPropertyName.Type); + options.SelectDiscriminatorValueUsing(clrType => _resourceGraph.GetResourceType(clrType).PublicName); + options.SelectSubTypesUsing(SelectDerivedTypes); + + options.TagActionsBy(description => GetOpenApiOperationTags(description, _controllerResourceMapping)); + options.CustomOperationIds(_operationIdSelector.GetOpenApiOperationId); + options.CustomSchemaIds(_schemaIdSelector.GetSchemaId); + + options.OperationFilter(); + options.DocumentFilter(); + options.DocumentFilter(); + options.DocumentFilter(); + options.DocumentFilter(); + options.DocumentFilter(); + } + + private List SelectDerivedTypes(Type baseType) + { + if (BaseToDerivedSchemaTypes.TryGetValue(baseType, out Type? schemaOpenType)) + { + return GetConstructedTypesFromResourceGraph(schemaOpenType); + } + + if (baseType == typeof(AtomicOperation)) + { + return GetConstructedTypesForAtomicOperation(); + } + + if (baseType.IsAssignableTo(typeof(IIdentifiable))) + { + ResourceType? resourceType = _resourceGraph.FindResourceType(baseType); + + if (resourceType != null && resourceType.IsPartOfTypeHierarchy()) + { + return GetResourceDerivedTypes(resourceType); + } + } + + return []; + } + + private List GetConstructedTypesFromResourceGraph(Type schemaOpenType) + { + List constructedTypes = []; + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) + { + Type constructedType = schemaOpenType.MakeGenericType(resourceType.ClrType); + constructedTypes.Add(constructedType); + } + + return constructedTypes; + } + + private List GetConstructedTypesForAtomicOperation() + { + List derivedTypes = []; + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) + { + derivedTypes.AddRange(AtomicOperationDerivedSchemaTypes.Select(openType => openType.MakeGenericType(resourceType.ClrType))); + } + + return derivedTypes; + } + + private static List GetResourceDerivedTypes(ResourceType baseType) + { + List clrTypes = []; + IncludeDerivedTypes(baseType, clrTypes); + return clrTypes; + } + + private static void IncludeDerivedTypes(ResourceType baseType, List clrTypes) + { + foreach (ResourceType derivedType in baseType.DirectlyDerivedTypes) + { + clrTypes.Add(derivedType.ClrType); + IncludeDerivedTypes(derivedType, clrTypes); + } + } + + private static List GetOpenApiOperationTags(ApiDescription description, IControllerResourceMapping controllerResourceMapping) + { + MethodInfo actionMethod = description.ActionDescriptor.GetActionMethod(); + ResourceType? resourceType = controllerResourceMapping.GetResourceTypeForController(actionMethod.ReflectedType); + + return resourceType == null ? ["operations"] : [resourceType.PublicName]; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConsistencyGuard.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConsistencyGuard.cs new file mode 100644 index 0000000000..a5ab4f69f5 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ConsistencyGuard.cs @@ -0,0 +1,18 @@ +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +#pragma warning disable AV1008 // Class should not be static + +internal static class ConsistencyGuard +{ + [ExcludeFromCodeCoverage] + public static void ThrowIf([DoesNotReturnIf(true)] bool condition) + { + if (condition) + { + throw new UnreachableException(); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs new file mode 100644 index 0000000000..ab9445b39e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IJsonApiRequestAccessor.cs @@ -0,0 +1,14 @@ +using JsonApiDotNetCore.Middleware; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Provides access to the current , if one is available. +/// +internal interface IJsonApiRequestAccessor +{ + /// + /// Gets the current . Returns null if there is no active request. + /// + IJsonApiRequest? Current { get; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ISchemaGenerationTraceScope.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ISchemaGenerationTraceScope.cs new file mode 100644 index 0000000000..e9cb25c7ef --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ISchemaGenerationTraceScope.cs @@ -0,0 +1,6 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal interface ISchemaGenerationTraceScope : IDisposable +{ + void TraceSucceeded(string schemaId); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs new file mode 100644 index 0000000000..97f86e2834 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/IncludeDependencyScanner.cs @@ -0,0 +1,53 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class IncludeDependencyScanner +{ + public static IncludeDependencyScanner Instance { get; } = new(); + + private IncludeDependencyScanner() + { + } + + /// + /// Returns all related resource types that are reachable from the specified resource type. Does not include itself. + /// + public IReadOnlySet GetReachableRelatedTypes(ResourceType resourceType) + { + ArgumentNullException.ThrowIfNull(resourceType); + + HashSet resourceTypesFound = []; + + IncludeResourceType(resourceType, resourceTypesFound); + resourceTypesFound.Remove(resourceType); + + return resourceTypesFound; + } + + private static void IncludeResourceType(ResourceType resourceType, ISet resourceTypesFound) + { + if (resourceTypesFound.Add(resourceType)) + { + IncludeDerivedTypes(resourceType, resourceTypesFound); + IncludeRelatedTypes(resourceType, resourceTypesFound); + } + } + + private static void IncludeDerivedTypes(ResourceType resourceType, ISet resourceTypesFound) + { + foreach (ResourceType derivedType in resourceType.DirectlyDerivedTypes) + { + IncludeResourceType(derivedType, resourceTypesFound); + } + } + + private static void IncludeRelatedTypes(ResourceType resourceType, ISet resourceTypesFound) + { + foreach (RelationshipAttribute relationship in resourceType.Relationships) + { + IncludeResourceType(relationship.RightType, resourceTypesFound); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiActionDescriptorCollectionProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiActionDescriptorCollectionProvider.cs new file mode 100644 index 0000000000..6d63a540cd --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiActionDescriptorCollectionProvider.cs @@ -0,0 +1,225 @@ +using System.Reflection; +using JsonApiDotNetCore.Errors; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Abstractions; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.Net.Http.Headers; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Adds JsonApiDotNetCore metadata to s if available. This translates to updating response types in +/// and performing an expansion for secondary and relationship endpoints. For example: +/// /article/{id}/author, /article/{id}/revisions, etc. +/// ]]> +/// +internal sealed class JsonApiActionDescriptorCollectionProvider : IActionDescriptorCollectionProvider +{ + private static readonly string DefaultMediaType = JsonApiMediaType.Default.ToString(); + + private readonly IActionDescriptorCollectionProvider _defaultProvider; + private readonly JsonApiEndpointMetadataProvider _jsonApiEndpointMetadataProvider; + + public ActionDescriptorCollection ActionDescriptors => GetActionDescriptors(); + + public JsonApiActionDescriptorCollectionProvider(IActionDescriptorCollectionProvider defaultProvider, + JsonApiEndpointMetadataProvider jsonApiEndpointMetadataProvider) + { + ArgumentNullException.ThrowIfNull(defaultProvider); + ArgumentNullException.ThrowIfNull(jsonApiEndpointMetadataProvider); + + _defaultProvider = defaultProvider; + _jsonApiEndpointMetadataProvider = jsonApiEndpointMetadataProvider; + } + + private ActionDescriptorCollection GetActionDescriptors() + { + List newDescriptors = _defaultProvider.ActionDescriptors.Items.ToList(); + ActionDescriptor[] endpoints = newDescriptors.Where(IsVisibleJsonApiEndpoint).ToArray(); + + foreach (ActionDescriptor endpoint in endpoints) + { + MethodInfo actionMethod = endpoint.GetActionMethod(); + JsonApiEndpointMetadataContainer endpointMetadataContainer = _jsonApiEndpointMetadataProvider.Get(actionMethod); + + List replacementDescriptorsForEndpoint = + [ + .. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.RequestMetadata), + .. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.ResponseMetadata) + ]; + + if (replacementDescriptorsForEndpoint.Count > 0) + { + newDescriptors.InsertRange(newDescriptors.IndexOf(endpoint), replacementDescriptorsForEndpoint); + newDescriptors.Remove(endpoint); + } + } + + int descriptorVersion = _defaultProvider.ActionDescriptors.Version; + return new ActionDescriptorCollection(newDescriptors.AsReadOnly(), descriptorVersion); + } + + internal static bool IsVisibleJsonApiEndpoint(ActionDescriptor descriptor) + { + // Only if in a convention ApiExplorer.IsVisible was set to false, the ApiDescriptionActionData will not be present. + return descriptor is ControllerActionDescriptor controllerAction && controllerAction.Properties.ContainsKey(typeof(ApiDescriptionActionData)); + } + + private static List AddJsonApiMetadataToAction(ActionDescriptor endpoint, IJsonApiEndpointMetadata? jsonApiEndpointMetadata) + { + switch (jsonApiEndpointMetadata) + { + case PrimaryResponseMetadata primaryMetadata: + { + UpdateProducesResponseTypeAttribute(endpoint, primaryMetadata.DocumentType); + return []; + } + case PrimaryRequestMetadata primaryMetadata: + { + UpdateBodyParameterDescriptor(endpoint, primaryMetadata.DocumentType, null); + return []; + } + case NonPrimaryEndpointMetadata nonPrimaryEndpointMetadata and (RelationshipResponseMetadata or SecondaryResponseMetadata): + { + return Expand(endpoint, nonPrimaryEndpointMetadata, + (expandedEndpoint, documentType, _) => UpdateProducesResponseTypeAttribute(expandedEndpoint, documentType)); + } + case NonPrimaryEndpointMetadata nonPrimaryEndpointMetadata and RelationshipRequestMetadata: + { + return Expand(endpoint, nonPrimaryEndpointMetadata, UpdateBodyParameterDescriptor); + } + case AtomicOperationsRequestMetadata: + { + UpdateBodyParameterDescriptor(endpoint, typeof(OperationsRequestDocument), null); + return []; + } + case AtomicOperationsResponseMetadata: + { + UpdateProducesResponseTypeAttribute(endpoint, typeof(OperationsResponseDocument)); + return []; + } + default: + { + return []; + } + } + } + + private static void UpdateProducesResponseTypeAttribute(ActionDescriptor endpoint, Type responseDocumentType) + { + ProducesResponseTypeAttribute? attribute = null; + + if (ProducesJsonApiResponseDocument(endpoint)) + { + var producesResponse = endpoint.GetFilterMetadata(); + + if (producesResponse != null) + { + attribute = producesResponse; + } + } + + ConsistencyGuard.ThrowIf(attribute == null); + attribute.Type = responseDocumentType; + } + + private static bool ProducesJsonApiResponseDocument(ActionDescriptor endpoint) + { + var produces = endpoint.GetFilterMetadata(); + + if (produces != null) + { + foreach (string contentType in produces.ContentTypes) + { + if (MediaTypeHeaderValue.TryParse(contentType, out MediaTypeHeaderValue? headerValue)) + { + if (headerValue.MediaType.Equals(DefaultMediaType, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + } + + return false; + } + + private static List Expand(ActionDescriptor genericEndpoint, NonPrimaryEndpointMetadata metadata, + Action expansionCallback) + { + List expansion = []; + + foreach ((string relationshipName, Type documentType) in metadata.DocumentTypesByRelationshipName) + { + if (genericEndpoint.AttributeRouteInfo == null) + { + throw new NotSupportedException("Only attribute routing is supported for JsonApiDotNetCore endpoints."); + } + + ActionDescriptor expandedEndpoint = Clone(genericEndpoint); + + RemovePathParameter(expandedEndpoint.Parameters, "relationshipName"); + + ExpandTemplate(expandedEndpoint.AttributeRouteInfo!, relationshipName); + + expansionCallback(expandedEndpoint, documentType, relationshipName); + + expansion.Add(expandedEndpoint); + } + + return expansion; + } + + private static void UpdateBodyParameterDescriptor(ActionDescriptor endpoint, Type documentType, string? parameterName) + { + ControllerParameterDescriptor? requestBodyDescriptor = endpoint.GetBodyParameterDescriptor(); + + if (requestBodyDescriptor == null) + { + MethodInfo actionMethod = endpoint.GetActionMethod(); + + throw new InvalidConfigurationException( + $"The action method '{actionMethod}' on type '{actionMethod.ReflectedType?.FullName}' contains no parameter with a [FromBody] attribute."); + } + + requestBodyDescriptor.ParameterType = documentType; + requestBodyDescriptor.ParameterInfo = new ParameterInfoWrapper(requestBodyDescriptor.ParameterInfo, documentType, parameterName); + } + + private static ActionDescriptor Clone(ActionDescriptor descriptor) + { + ActionDescriptor clone = descriptor.MemberwiseClone(); + clone.AttributeRouteInfo = descriptor.AttributeRouteInfo!.MemberwiseClone(); + clone.FilterDescriptors = descriptor.FilterDescriptors.Select(Clone).ToList(); + clone.Parameters = descriptor.Parameters.Select(parameter => parameter.MemberwiseClone()).ToList(); + return clone; + } + + private static FilterDescriptor Clone(FilterDescriptor descriptor) + { + IFilterMetadata clone = descriptor.Filter.MemberwiseClone(); + + return new FilterDescriptor(clone, descriptor.Scope) + { + Order = descriptor.Order + }; + } + + private static void RemovePathParameter(ICollection parameters, string parameterName) + { + ParameterDescriptor descriptor = parameters.Single(parameterDescriptor => parameterDescriptor.Name == parameterName); + parameters.Remove(descriptor); + } + + private static void ExpandTemplate(AttributeRouteInfo route, string expansionParameter) + { + route.Template = route.Template!.Replace("{relationshipName}", expansionParameter); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiDotNetCore.OpenApi.Swashbuckle.csproj b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiDotNetCore.OpenApi.Swashbuckle.csproj new file mode 100644 index 0000000000..89822ff4b3 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiDotNetCore.OpenApi.Swashbuckle.csproj @@ -0,0 +1,39 @@ + + + net8.0 + true + true + false + + + + + + $(VersionPrefix)-preview.$(OpenApiPreviewNumber) + jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api;openapi;swagger;swaggerui;swashbuckle + A Swashbuckle integration that enables you to describe a JsonApiDotNetCore API with an OpenAPI specification. + json-api-dotnet + https://www.jsonapi.net/ + MIT + false + See https://github.com/json-api-dotnet/JsonApiDotNetCore/releases. + package-icon.png + PackageReadme.md + true + embedded + + + + + + + + + + + + + + + + diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsRequestMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsRequestMetadata.cs new file mode 100644 index 0000000000..b9b0f44462 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsRequestMetadata.cs @@ -0,0 +1,10 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class AtomicOperationsRequestMetadata : IJsonApiRequestMetadata +{ + public static AtomicOperationsRequestMetadata Instance { get; } = new(); + + private AtomicOperationsRequestMetadata() + { + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsResponseMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsResponseMetadata.cs new file mode 100644 index 0000000000..838055c378 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/AtomicOperationsResponseMetadata.cs @@ -0,0 +1,10 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class AtomicOperationsResponseMetadata : IJsonApiResponseMetadata +{ + public static AtomicOperationsResponseMetadata Instance { get; } = new(); + + private AtomicOperationsResponseMetadata() + { + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/EndpointResolver.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/EndpointResolver.cs new file mode 100644 index 0000000000..e4c074f081 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/EndpointResolver.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Mvc.Routing; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class EndpointResolver +{ + public static EndpointResolver Instance { get; } = new(); + + private EndpointResolver() + { + } + + public JsonApiEndpoints GetEndpoint(MethodInfo controllerAction) + { + ArgumentNullException.ThrowIfNull(controllerAction); + + if (!IsJsonApiController(controllerAction)) + { + return JsonApiEndpoints.None; + } + + IEnumerable httpMethodAttributes = controllerAction.GetCustomAttributes(true); + return httpMethodAttributes.GetJsonApiEndpoint(); + } + + private bool IsJsonApiController(MethodInfo controllerAction) + { + return typeof(CoreJsonApiController).IsAssignableFrom(controllerAction.ReflectedType); + } + + public bool IsAtomicOperationsController(MethodInfo controllerAction) + { + return typeof(BaseJsonApiOperationsController).IsAssignableFrom(controllerAction.ReflectedType); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiEndpointMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiEndpointMetadata.cs new file mode 100644 index 0000000000..01a8247ec5 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiEndpointMetadata.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal interface IJsonApiEndpointMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiRequestMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiRequestMetadata.cs new file mode 100644 index 0000000000..86fbddebb6 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiRequestMetadata.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal interface IJsonApiRequestMetadata : IJsonApiEndpointMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiResponseMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiResponseMetadata.cs new file mode 100644 index 0000000000..85fb69e856 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/IJsonApiResponseMetadata.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal interface IJsonApiResponseMetadata : IJsonApiEndpointMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataContainer.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataContainer.cs new file mode 100644 index 0000000000..60b7182eb6 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataContainer.cs @@ -0,0 +1,10 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +/// +/// Metadata available at runtime about a JsonApiDotNetCore endpoint. +/// +internal sealed class JsonApiEndpointMetadataContainer(IJsonApiRequestMetadata? requestMetadata, IJsonApiResponseMetadata? responseMetadata) +{ + public IJsonApiRequestMetadata? RequestMetadata { get; } = requestMetadata; + public IJsonApiResponseMetadata? ResponseMetadata { get; } = responseMetadata; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs new file mode 100644 index 0000000000..6fd6f9e42e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/JsonApiEndpointMetadataProvider.cs @@ -0,0 +1,123 @@ +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.Resources.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +/// +/// Provides JsonApiDotNetCore related metadata for an ASP.NET controller action that can only be computed from the at +/// runtime. +/// +internal sealed class JsonApiEndpointMetadataProvider +{ + private readonly IControllerResourceMapping _controllerResourceMapping; + private readonly NonPrimaryDocumentTypeFactory _nonPrimaryDocumentTypeFactory; + + public JsonApiEndpointMetadataProvider(IControllerResourceMapping controllerResourceMapping, NonPrimaryDocumentTypeFactory nonPrimaryDocumentTypeFactory) + { + ArgumentNullException.ThrowIfNull(controllerResourceMapping); + ArgumentNullException.ThrowIfNull(nonPrimaryDocumentTypeFactory); + + _controllerResourceMapping = controllerResourceMapping; + _nonPrimaryDocumentTypeFactory = nonPrimaryDocumentTypeFactory; + } + + public JsonApiEndpointMetadataContainer Get(MethodInfo controllerAction) + { + ArgumentNullException.ThrowIfNull(controllerAction); + + if (EndpointResolver.Instance.IsAtomicOperationsController(controllerAction)) + { + return new JsonApiEndpointMetadataContainer(AtomicOperationsRequestMetadata.Instance, AtomicOperationsResponseMetadata.Instance); + } + + JsonApiEndpoints endpoint = EndpointResolver.Instance.GetEndpoint(controllerAction); + + if (endpoint == JsonApiEndpoints.None) + { + throw new NotSupportedException($"Unable to provide metadata for non-JSON:API endpoint '{controllerAction.ReflectedType!.FullName}'."); + } + + ResourceType? primaryResourceType = _controllerResourceMapping.GetResourceTypeForController(controllerAction.ReflectedType); + ConsistencyGuard.ThrowIf(primaryResourceType == null); + + IJsonApiRequestMetadata? requestMetadata = GetRequestMetadata(endpoint, primaryResourceType); + IJsonApiResponseMetadata? responseMetadata = GetResponseMetadata(endpoint, primaryResourceType); + return new JsonApiEndpointMetadataContainer(requestMetadata, responseMetadata); + } + + private IJsonApiRequestMetadata? GetRequestMetadata(JsonApiEndpoints endpoint, ResourceType primaryResourceType) + { + return endpoint switch + { + JsonApiEndpoints.Post => GetPostResourceRequestMetadata(primaryResourceType.ClrType), + JsonApiEndpoints.Patch => GetPatchResourceRequestMetadata(primaryResourceType.ClrType), + JsonApiEndpoints.PostRelationship or JsonApiEndpoints.PatchRelationship or JsonApiEndpoints.DeleteRelationship => GetRelationshipRequestMetadata( + primaryResourceType.Relationships, endpoint != JsonApiEndpoints.PatchRelationship), + _ => null + }; + } + + private static PrimaryRequestMetadata GetPostResourceRequestMetadata(Type resourceClrType) + { + Type documentType = typeof(CreateRequestDocument<>).MakeGenericType(resourceClrType); + + return new PrimaryRequestMetadata(documentType); + } + + private static PrimaryRequestMetadata GetPatchResourceRequestMetadata(Type resourceClrType) + { + Type documentType = typeof(UpdateRequestDocument<>).MakeGenericType(resourceClrType); + + return new PrimaryRequestMetadata(documentType); + } + + private RelationshipRequestMetadata GetRelationshipRequestMetadata(IEnumerable relationships, bool ignoreHasOneRelationships) + { + IEnumerable relationshipsOfEndpoint = ignoreHasOneRelationships ? relationships.OfType() : relationships; + + IDictionary requestDocumentTypesByRelationshipName = relationshipsOfEndpoint.ToDictionary(relationship => relationship.PublicName, + _nonPrimaryDocumentTypeFactory.GetForRelationshipRequest); + + return new RelationshipRequestMetadata(requestDocumentTypesByRelationshipName); + } + + private IJsonApiResponseMetadata? GetResponseMetadata(JsonApiEndpoints endpoint, ResourceType primaryResourceType) + { + return endpoint switch + { + JsonApiEndpoints.GetCollection or JsonApiEndpoints.GetSingle or JsonApiEndpoints.Post or JsonApiEndpoints.Patch => GetPrimaryResponseMetadata( + primaryResourceType.ClrType, endpoint == JsonApiEndpoints.GetCollection), + JsonApiEndpoints.GetSecondary => GetSecondaryResponseMetadata(primaryResourceType.Relationships), + JsonApiEndpoints.GetRelationship => GetRelationshipResponseMetadata(primaryResourceType.Relationships), + _ => null + }; + } + + private static PrimaryResponseMetadata GetPrimaryResponseMetadata(Type resourceClrType, bool endpointReturnsCollection) + { + Type documentOpenType = endpointReturnsCollection ? typeof(CollectionResponseDocument<>) : typeof(PrimaryResponseDocument<>); + Type documentType = documentOpenType.MakeGenericType(resourceClrType); + + return new PrimaryResponseMetadata(documentType); + } + + private SecondaryResponseMetadata GetSecondaryResponseMetadata(IEnumerable relationships) + { + IDictionary responseDocumentTypesByRelationshipName = relationships.ToDictionary(relationship => relationship.PublicName, + _nonPrimaryDocumentTypeFactory.GetForSecondaryResponse); + + return new SecondaryResponseMetadata(responseDocumentTypesByRelationshipName); + } + + private RelationshipResponseMetadata GetRelationshipResponseMetadata(IEnumerable relationships) + { + IDictionary responseDocumentTypesByRelationshipName = relationships.ToDictionary(relationship => relationship.PublicName, + _nonPrimaryDocumentTypeFactory.GetForRelationshipResponse); + + return new RelationshipResponseMetadata(responseDocumentTypesByRelationshipName); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs new file mode 100644 index 0000000000..7550d59ab3 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryDocumentTypeFactory.cs @@ -0,0 +1,80 @@ +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.Resources.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class NonPrimaryDocumentTypeFactory +{ + private static readonly DocumentOpenTypes SecondaryResponseDocumentOpenTypes = new(typeof(CollectionResponseDocument<>), + typeof(NullableSecondaryResponseDocument<>), typeof(SecondaryResponseDocument<>)); + + private static readonly DocumentOpenTypes RelationshipRequestDocumentOpenTypes = new(typeof(ToManyInRequest<>), + typeof(NullableToOneInRequest<>), typeof(ToOneInRequest<>)); + + private static readonly DocumentOpenTypes RelationshipResponseDocumentOpenTypes = new(typeof(IdentifierCollectionResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>), typeof(IdentifierResponseDocument<>)); + + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + + public NonPrimaryDocumentTypeFactory(ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider) + { + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + } + + public Type GetForSecondaryResponse(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return Get(relationship, SecondaryResponseDocumentOpenTypes); + } + + public Type GetForRelationshipRequest(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return Get(relationship, RelationshipRequestDocumentOpenTypes); + } + + public Type GetForRelationshipResponse(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return Get(relationship, RelationshipResponseDocumentOpenTypes); + } + + private Type Get(RelationshipAttribute relationship, DocumentOpenTypes types) + { + // @formatter:nested_ternary_style expanded + + Type documentOpenType = relationship is HasManyAttribute + ? types.ManyDataOpenType + : _resourceFieldValidationMetadataProvider.IsNullable(relationship) + ? types.NullableSingleDataOpenType + : types.SingleDataOpenType; + + // @formatter:nested_ternary_style restore + + return documentOpenType.MakeGenericType(relationship.RightType.ClrType); + } + + private sealed class DocumentOpenTypes + { + public Type ManyDataOpenType { get; } + public Type NullableSingleDataOpenType { get; } + public Type SingleDataOpenType { get; } + + public DocumentOpenTypes(Type manyDataOpenType, Type nullableSingleDataOpenType, Type singleDataOpenType) + { + ArgumentNullException.ThrowIfNull(manyDataOpenType); + ArgumentNullException.ThrowIfNull(nullableSingleDataOpenType); + ArgumentNullException.ThrowIfNull(singleDataOpenType); + + ManyDataOpenType = manyDataOpenType; + NullableSingleDataOpenType = nullableSingleDataOpenType; + SingleDataOpenType = singleDataOpenType; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryEndpointMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryEndpointMetadata.cs new file mode 100644 index 0000000000..ed43dc4da8 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/NonPrimaryEndpointMetadata.cs @@ -0,0 +1,13 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal abstract class NonPrimaryEndpointMetadata +{ + public IDictionary DocumentTypesByRelationshipName { get; } + + protected NonPrimaryEndpointMetadata(IDictionary documentTypesByRelationshipName) + { + ArgumentNullException.ThrowIfNull(documentTypesByRelationshipName); + + DocumentTypesByRelationshipName = documentTypesByRelationshipName; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryRequestMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryRequestMetadata.cs new file mode 100644 index 0000000000..7c224417f1 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryRequestMetadata.cs @@ -0,0 +1,13 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class PrimaryRequestMetadata : IJsonApiRequestMetadata +{ + public Type DocumentType { get; } + + public PrimaryRequestMetadata(Type documentType) + { + ArgumentNullException.ThrowIfNull(documentType); + + DocumentType = documentType; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryResponseMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryResponseMetadata.cs new file mode 100644 index 0000000000..2d2590be7d --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/PrimaryResponseMetadata.cs @@ -0,0 +1,13 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class PrimaryResponseMetadata : IJsonApiResponseMetadata +{ + public Type DocumentType { get; } + + public PrimaryResponseMetadata(Type documentType) + { + ArgumentNullException.ThrowIfNull(documentType); + + DocumentType = documentType; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipRequestMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipRequestMetadata.cs new file mode 100644 index 0000000000..e2636da079 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipRequestMetadata.cs @@ -0,0 +1,4 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class RelationshipRequestMetadata(IDictionary documentTypesByRelationshipName) + : NonPrimaryEndpointMetadata(documentTypesByRelationshipName), IJsonApiRequestMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipResponseMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipResponseMetadata.cs new file mode 100644 index 0000000000..7221dfbe5e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipResponseMetadata.cs @@ -0,0 +1,4 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class RelationshipResponseMetadata(IDictionary documentTypesByRelationshipName) + : NonPrimaryEndpointMetadata(documentTypesByRelationshipName), IJsonApiResponseMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs new file mode 100644 index 0000000000..be5a6fd30c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/RelationshipTypeFactory.cs @@ -0,0 +1,44 @@ +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.Resources.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class RelationshipTypeFactory +{ + private readonly NonPrimaryDocumentTypeFactory _nonPrimaryDocumentTypeFactory; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + + public RelationshipTypeFactory(NonPrimaryDocumentTypeFactory nonPrimaryDocumentTypeFactory, + ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider) + { + ArgumentNullException.ThrowIfNull(nonPrimaryDocumentTypeFactory); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + + _nonPrimaryDocumentTypeFactory = nonPrimaryDocumentTypeFactory; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + } + + public Type GetForRequest(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return _nonPrimaryDocumentTypeFactory.GetForRelationshipRequest(relationship); + } + + public Type GetForResponse(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + // @formatter:nested_ternary_style expanded + + Type relationshipDataOpenType = relationship is HasManyAttribute + ? typeof(ToManyInResponse<>) + : _resourceFieldValidationMetadataProvider.IsNullable(relationship) + ? typeof(NullableToOneInResponse<>) + : typeof(ToOneInResponse<>); + + // @formatter:nested_ternary_style restore + + return relationshipDataOpenType.MakeGenericType(relationship.RightType.ClrType); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/SecondaryResponseMetadata.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/SecondaryResponseMetadata.cs new file mode 100644 index 0000000000..39b8ce8d4f --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiMetadata/SecondaryResponseMetadata.cs @@ -0,0 +1,4 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; + +internal sealed class SecondaryResponseMetadata(IDictionary documentTypesByRelationshipName) + : NonPrimaryEndpointMetadata(documentTypesByRelationshipName), IJsonApiResponseMetadata; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs new file mode 100644 index 0000000000..bf461fe41a --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AddToRelationshipOperation.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class AddToRelationshipOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("ref")] + public object Ref { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs new file mode 100644 index 0000000000..6f0934008d --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicOperation.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal abstract class AtomicOperation : IHasMeta +{ + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs new file mode 100644 index 0000000000..f4dec21cbf --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/AtomicResult.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class AtomicResult : IHasMeta +{ + [JsonPropertyName("data")] + public ResourceInResponse Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs new file mode 100644 index 0000000000..266712e666 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/CreateOperation.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class CreateOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public DataInCreateRequest Data { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs new file mode 100644 index 0000000000..838b4400dd --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/DeleteOperation.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class DeleteOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("ref")] + public IdentifierInRequest Ref { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs new file mode 100644 index 0000000000..eafe36028e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/RemoveFromRelationshipOperation.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class RemoveFromRelationshipOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("ref")] + public object Ref { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs new file mode 100644 index 0000000000..cb576c3a4f --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateOperation.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class UpdateOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [JsonPropertyName("ref")] + public IdentifierInRequest Ref { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public DataInUpdateRequest Data { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs new file mode 100644 index 0000000000..2725b3dd9f --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToManyRelationshipOperation.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class UpdateToManyRelationshipOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("ref")] + public object Ref { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs new file mode 100644 index 0000000000..71c6528605 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/AtomicOperations/UpdateToOneRelationshipOperation.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class UpdateToOneRelationshipOperation : AtomicOperation + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("op")] + public string Op { get; set; } = null!; + + [Required] + [JsonPropertyName("ref")] + public object Ref { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + // Nullability of this property is determined based on the nullability of the to-one relationship. + public IdentifierInRequest? Data { get; set; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs new file mode 100644 index 0000000000..bfb0131f07 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CollectionResponseDocument.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class CollectionResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceCollectionTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; + + [JsonPropertyName("included")] + public IList Included { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs new file mode 100644 index 0000000000..388d659398 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/CreateRequestDocument.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class CreateRequestDocument : IHasMeta + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("data")] + public DataInCreateRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs new file mode 100644 index 0000000000..750c83ef74 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/ErrorResponseDocument.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.Serialization.Objects; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ErrorResponseDocument : IHasMeta +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ErrorTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("errors")] + public IList Errors { get; set; } = new List(); + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..bf50821888 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierCollectionResponseDocument.cs @@ -0,0 +1,27 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class IdentifierCollectionResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceIdentifierCollectionTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs new file mode 100644 index 0000000000..3c44955edc --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/IdentifierResponseDocument.cs @@ -0,0 +1,27 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class IdentifierResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceIdentifierTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public IdentifierInResponse Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.cs new file mode 100644 index 0000000000..1386bec001 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableIdentifierResponseDocument.cs @@ -0,0 +1,29 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +// Types in the JsonApiObjects namespace are never touched by ASP.NET ModelState validation, therefore using a non-nullable reference type for a property does not +// imply this property is required. Instead, we use [Required] explicitly, because this is how Swashbuckle is instructed to mark properties as required. +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class NullableIdentifierResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceIdentifierTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public IdentifierInResponse? Data { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs new file mode 100644 index 0000000000..6d6d240a5b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/NullableSecondaryResponseDocument.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class NullableSecondaryResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public DataInResponse? Data { get; set; } + + [JsonPropertyName("included")] + public IList Included { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs new file mode 100644 index 0000000000..6bd3a1dad2 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsRequestDocument.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class OperationsRequestDocument : IHasMeta +{ + [Required] + [MinLength(1)] + [JsonPropertyName("atomic:operations")] + public ICollection Operations { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs new file mode 100644 index 0000000000..1c962fba84 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/OperationsResponseDocument.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class OperationsResponseDocument : IHasMeta +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceTopLevelLinks Links { get; set; } = null!; + + [Required] + [MinLength(1)] + [JsonPropertyName("atomic:results")] + public IList Results { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs new file mode 100644 index 0000000000..1956fb8758 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/PrimaryResponseDocument.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class PrimaryResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public DataInResponse Data { get; set; } = null!; + + [JsonPropertyName("included")] + public IList Included { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs new file mode 100644 index 0000000000..6a90db36e1 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/SecondaryResponseDocument.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class SecondaryResponseDocument : IHasMeta + where TResource : IIdentifiable +{ + [JsonPropertyName("jsonapi")] + public Jsonapi Jsonapi { get; set; } = null!; + + [Required] + [JsonPropertyName("links")] + public ResourceTopLevelLinks Links { get; set; } = null!; + + [Required] + [JsonPropertyName("data")] + public DataInResponse Data { get; set; } = null!; + + [JsonPropertyName("included")] + public IList Included { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs new file mode 100644 index 0000000000..cbeec3e86b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Documents/UpdateRequestDocument.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class UpdateRequestDocument : IHasMeta + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("data")] + public DataInUpdateRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs new file mode 100644 index 0000000000..64315dee42 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/IHasMeta.cs @@ -0,0 +1,9 @@ +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal interface IHasMeta +{ + Meta Meta { get; set; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs new file mode 100644 index 0000000000..692b5d77ac --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Jsonapi.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class Jsonapi : IHasMeta +{ + [JsonPropertyName("version")] + public string Version { get; set; } = null!; + + [JsonPropertyName("ext")] + public ICollection Ext { get; set; } = null!; + + [JsonPropertyName("profile")] + public ICollection Profile { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ErrorTopLevelLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..f98c9eb480 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ErrorTopLevelLinks.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ErrorTopLevelLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("describedby")] + public string Describedby { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/RelationshipLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/RelationshipLinks.cs new file mode 100644 index 0000000000..0bdae58dee --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/RelationshipLinks.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class RelationshipLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("related")] + public string Related { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..65710af45f --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ResourceCollectionTopLevelLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("describedby")] + public string Describedby { get; set; } = null!; + + [JsonPropertyName("first")] + public string First { get; set; } = null!; + + [JsonPropertyName("last")] + public string Last { get; set; } = null!; + + [JsonPropertyName("prev")] + public string Prev { get; set; } = null!; + + [JsonPropertyName("next")] + public string Next { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..8b9a3aaf55 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ResourceIdentifierCollectionTopLevelLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("related")] + public string Related { get; set; } = null!; + + [JsonPropertyName("describedby")] + public string Describedby { get; set; } = null!; + + [JsonPropertyName("first")] + public string First { get; set; } = null!; + + [JsonPropertyName("last")] + public string Last { get; set; } = null!; + + [JsonPropertyName("prev")] + public string Prev { get; set; } = null!; + + [JsonPropertyName("next")] + public string Next { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..9af21cf6a1 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ResourceIdentifierTopLevelLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("related")] + public string Related { get; set; } = null!; + + [JsonPropertyName("describedby")] + public string Describedby { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceLinks.cs new file mode 100644 index 0000000000..a37ef69523 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceLinks.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ResourceLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceTopLevelLinks.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..531c8d10ad --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Links/ResourceTopLevelLinks.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ResourceTopLevelLinks +{ + [JsonPropertyName("self")] + public string Self { get; set; } = null!; + + [JsonPropertyName("describedby")] + public string Describedby { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Meta.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Meta.cs new file mode 100644 index 0000000000..a85cd3498a --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Meta.cs @@ -0,0 +1,9 @@ +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class Meta +{ + // No members, because the component schema is custom-generated. +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs new file mode 100644 index 0000000000..13f3290102 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInRequest.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class NullableToOneInRequest : IHasMeta + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("data")] + public IdentifierInRequest? Data { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInResponse.cs new file mode 100644 index 0000000000..29d13dd1c2 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/NullableToOneInResponse.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class NullableToOneInResponse : IHasMeta + where TResource : IIdentifiable +{ + // Non-required because the related controller may be unavailable when used in an include. + [JsonPropertyName("links")] + public RelationshipLinks Links { get; set; } = null!; + + // Non-required because related data may not be included in the response. + [JsonPropertyName("data")] + public IdentifierInResponse? Data { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs new file mode 100644 index 0000000000..b80ab3a004 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInRequest.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ToManyInRequest : IHasMeta + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInResponse.cs new file mode 100644 index 0000000000..e60ab7f451 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToManyInResponse.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ToManyInResponse : IHasMeta + where TResource : IIdentifiable +{ + // Non-required because the related controller may be unavailable when used in an include. + [JsonPropertyName("links")] + public RelationshipLinks Links { get; set; } = null!; + + // Non-required because related data may not be included in the response. + [JsonPropertyName("data")] + public ICollection> Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs new file mode 100644 index 0000000000..6404e84545 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInRequest.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ToOneInRequest : IHasMeta + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("data")] + public IdentifierInRequest Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInResponse.cs new file mode 100644 index 0000000000..859a1de929 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/Relationships/ToOneInResponse.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class ToOneInResponse : IHasMeta + where TResource : IIdentifiable +{ + // Non-required because the related controller may be unavailable when used in an include. + [JsonPropertyName("links")] + public RelationshipLinks Links { get; set; } = null!; + + // Non-required because related data may not be included in the response. + [JsonPropertyName("data")] + public IdentifierInResponse Data { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..0b8fddc0da --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInCreateRequest.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class AttributesInCreateRequest; + +// ReSharper disable once UnusedTypeParameter +internal sealed class AttributesInCreateRequest : AttributesInCreateRequest + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs new file mode 100644 index 0000000000..d4b1bb728c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInResponse.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class AttributesInResponse; + +// ReSharper disable once UnusedTypeParameter +internal sealed class AttributesInResponse : AttributesInResponse + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..d41bf18782 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/AttributesInUpdateRequest.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class AttributesInUpdateRequest; + +// ReSharper disable once UnusedTypeParameter +internal sealed class AttributesInUpdateRequest : AttributesInUpdateRequest + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs new file mode 100644 index 0000000000..ac416a1614 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInCreateRequest.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class DataInCreateRequest : ResourceInCreateRequest + where TResource : IIdentifiable +{ + [MinLength(1)] + [JsonPropertyName("id")] + public override string Id { get; set; } = null!; + + [MinLength(1)] + [JsonPropertyName("lid")] + public string Lid { get; set; } = null!; + + [JsonPropertyName("attributes")] + public AttributesInCreateRequest Attributes { get; set; } = null!; + + [JsonPropertyName("relationships")] + public RelationshipsInCreateRequest Relationships { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs new file mode 100644 index 0000000000..6015a3511d --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInResponse.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Links; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class DataInResponse : ResourceInResponse + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("id")] + public override string Id { get; set; } = null!; + + [JsonPropertyName("attributes")] + public AttributesInResponse Attributes { get; set; } = null!; + + [JsonPropertyName("relationships")] + public RelationshipsInResponse Relationships { get; set; } = null!; + + // Non-required because the related controller may be unavailable when used in an include. + [JsonPropertyName("links")] + public ResourceLinks Links { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs new file mode 100644 index 0000000000..25167a5437 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/DataInUpdateRequest.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class DataInUpdateRequest : ResourceInUpdateRequest + where TResource : IIdentifiable +{ + [MinLength(1)] + [JsonPropertyName("id")] + public override string Id { get; set; } = null!; + + [MinLength(1)] + [JsonPropertyName("lid")] + public string Lid { get; set; } = null!; + + [JsonPropertyName("attributes")] + public AttributesInUpdateRequest Attributes { get; set; } = null!; + + [JsonPropertyName("relationships")] + public RelationshipsInUpdateRequest Relationships { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs new file mode 100644 index 0000000000..52985d68d9 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IResourceIdentity.cs @@ -0,0 +1,10 @@ +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal interface IResourceIdentity : IHasMeta +{ + string Type { get; set; } + string Id { get; set; } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs new file mode 100644 index 0000000000..f317498810 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInRequest.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal class IdentifierInRequest : IHasMeta +{ + [Required] + [JsonPropertyName("type")] + public string Type { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} + +// ReSharper disable once UnusedTypeParameter +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal class IdentifierInRequest : IdentifierInRequest, IResourceIdentity + where TResource : IIdentifiable +{ + [MinLength(1)] + [JsonPropertyName("id")] + public string Id { get; set; } = null!; + + [MinLength(1)] + [JsonPropertyName("lid")] + public string Lid { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInResponse.cs new file mode 100644 index 0000000000..47bf94ce17 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/IdentifierInResponse.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +// ReSharper disable once UnusedTypeParameter +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class IdentifierInResponse : IResourceIdentity + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("type")] + public string Type { get; set; } = null!; + + [Required] + [JsonPropertyName("id")] + public string Id { get; set; } = null!; + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs new file mode 100644 index 0000000000..34afbf1dc2 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipIdentifier.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal sealed class RelationshipIdentifier : IdentifierInRequest + where TResource : IIdentifiable +{ + [Required] + [JsonPropertyName("relationship")] + public string Relationship { get; set; } = null!; + + // Meta is erased at runtime. +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..44698c3b57 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInCreateRequest.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class RelationshipsInCreateRequest; + +// ReSharper disable once UnusedTypeParameter +internal sealed class RelationshipsInCreateRequest : RelationshipsInCreateRequest + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs new file mode 100644 index 0000000000..24222743ce --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInResponse.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class RelationshipsInResponse; + +// ReSharper disable once UnusedTypeParameter +internal sealed class RelationshipsInResponse : RelationshipsInResponse + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..bc851b97d5 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/RelationshipsInUpdateRequest.cs @@ -0,0 +1,9 @@ +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class RelationshipsInUpdateRequest; + +// ReSharper disable once UnusedTypeParameter +internal sealed class RelationshipsInUpdateRequest : RelationshipsInUpdateRequest + where TResource : IIdentifiable; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs new file mode 100644 index 0000000000..746c696545 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceData.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +using JetBrains.Annotations; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +internal abstract class ResourceData : IResourceIdentity +{ + [Required] + [JsonPropertyName("type")] + public string Type { get; set; } = null!; + + public abstract string Id { get; set; } + + [JsonPropertyName("meta")] + public Meta Meta { get; set; } = null!; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..838ab6a4ca --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInCreateRequest.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInCreateRequest : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs new file mode 100644 index 0000000000..2df01cc319 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInResponse.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInResponse : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..63e5faae72 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiObjects/ResourceObjects/ResourceInUpdateRequest.cs @@ -0,0 +1,3 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; + +internal abstract class ResourceInUpdateRequest : ResourceData; diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiPropertyName.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiPropertyName.cs new file mode 100644 index 0000000000..1526450f16 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiPropertyName.cs @@ -0,0 +1,19 @@ +#pragma warning disable AV1008 // Class should not be static + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class JsonApiPropertyName +{ + public const string Jsonapi = "jsonapi"; + public const string Links = "links"; + public const string Data = "data"; + public const string Type = "type"; + public const string Id = "id"; + public const string Lid = "lid"; + public const string Attributes = "attributes"; + public const string Relationships = "relationships"; + public const string Op = "op"; + public const string Ref = "ref"; + public const string Relationship = "relationship"; + public const string Meta = "meta"; +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs new file mode 100644 index 0000000000..b466d78442 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestAccessor.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +internal sealed class JsonApiRequestAccessor : IJsonApiRequestAccessor +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + /// + public IJsonApiRequest? Current => _httpContextAccessor.HttpContext?.RequestServices.GetService(); + + public JsonApiRequestAccessor(IHttpContextAccessor httpContextAccessor) + { + ArgumentNullException.ThrowIfNull(httpContextAccessor); + + _httpContextAccessor = httpContextAccessor; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestFormatMetadataProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestFormatMetadataProvider.cs new file mode 100644 index 0000000000..6def822bd9 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiRequestFormatMetadataProvider.cs @@ -0,0 +1,42 @@ +using System.Diagnostics; +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Net.Http.Headers; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class JsonApiRequestFormatMetadataProvider : IInputFormatter, IApiRequestFormatMetadataProvider +{ + private static readonly string DefaultMediaType = JsonApiMediaType.Default.ToString(); + + /// + public bool CanRead(InputFormatterContext context) + { + return false; + } + + /// + public Task ReadAsync(InputFormatterContext context) + { + throw new UnreachableException(); + } + + /// + public IReadOnlyList GetSupportedContentTypes(string contentType, Type objectType) + { + ArgumentException.ThrowIfNullOrEmpty(contentType); + ArgumentNullException.ThrowIfNull(objectType); + + if (JsonApiSchemaFacts.IsRequestBodySchemaType(objectType) && MediaTypeHeaderValue.TryParse(contentType, out MediaTypeHeaderValue? headerValue) && + headerValue.MediaType.Equals(DefaultMediaType, StringComparison.OrdinalIgnoreCase)) + { + return new MediaTypeCollection + { + headerValue + }; + } + + return []; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs new file mode 100644 index 0000000000..bf91aed0e7 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaFacts.cs @@ -0,0 +1,54 @@ +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; + +#pragma warning disable AV1008 // Class should not be static + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class JsonApiSchemaFacts +{ + private static readonly Type[] RequestBodySchemaTypes = + [ + typeof(CreateRequestDocument<>), + typeof(UpdateRequestDocument<>), + typeof(ToOneInRequest<>), + typeof(NullableToOneInRequest<>), + typeof(ToManyInRequest<>), + typeof(OperationsRequestDocument) + ]; + + private static readonly Type[] SchemaTypesHavingNullableDataProperty = + [ + typeof(NullableToOneInRequest<>), + typeof(NullableToOneInResponse<>), + typeof(NullableSecondaryResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>) + ]; + + private static readonly Type[] RelationshipInResponseSchemaTypes = + [ + typeof(ToOneInResponse<>), + typeof(ToManyInResponse<>), + typeof(NullableToOneInResponse<>) + ]; + + public static bool IsRequestBodySchemaType(Type schemaType) + { + Type lookupType = schemaType.ConstructedToOpenType(); + return RequestBodySchemaTypes.Contains(lookupType); + } + + public static bool HasNullableDataProperty(Type schemaType) + { + // Swashbuckle infers non-nullable because our Data properties are [Required]. + + Type lookupType = schemaType.ConstructedToOpenType(); + return SchemaTypesHavingNullableDataProperty.Contains(lookupType); + } + + public static bool IsRelationshipInResponseType(Type schemaType) + { + Type lookupType = schemaType.ConstructedToOpenType(); + return RelationshipInResponseSchemaTypes.Contains(lookupType); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs new file mode 100644 index 0000000000..0e2fc803de --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs @@ -0,0 +1,208 @@ +using System.Text.Json; +using Humanizer; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Serialization.Objects; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class JsonApiSchemaIdSelector +{ + private const string ResourceTypeSchemaIdTemplate = "[ResourceName] Resource Type"; + private const string MetaSchemaIdTemplate = "Meta"; + + private const string ResourceAtomicOperationDiscriminatorValueTemplate = "[OperationCode] [ResourceName]"; + private const string UpdateRelationshipAtomicOperationDiscriminatorValueTemplate = "Update [ResourceName] [RelationshipName]"; + private const string AddToRelationshipAtomicOperationDiscriminatorValueTemplate = "Add To [ResourceName] [RelationshipName]"; + private const string RemoveFromRelationshipAtomicOperationDiscriminatorValueTemplate = "Remove From [ResourceName] [RelationshipName]"; + + private const string UpdateRelationshipAtomicOperationSchemaIdTemplate = "Update [ResourceName] [RelationshipName] Relationship Operation"; + private const string AddToRelationshipAtomicOperationSchemaIdTemplate = "Add To [ResourceName] [RelationshipName] Relationship Operation"; + private const string RemoveFromRelationshipAtomicOperationSchemaIdTemplate = "Remove From [ResourceName] [RelationshipName] Relationship Operation"; + private const string RelationshipIdentifierSchemaIdTemplate = "[ResourceName] [RelationshipName] Relationship Identifier"; + private const string RelationshipNameSchemaIdTemplate = "[ResourceName] [RelationshipName] Relationship Name"; + + private static readonly Dictionary SchemaTypeToTemplateMap = new() + { + [typeof(CreateRequestDocument<>)] = "Create [ResourceName] Request Document", + [typeof(UpdateRequestDocument<>)] = "Update [ResourceName] Request Document", + [typeof(ResourceInCreateRequest)] = "Resource In Create Request", + [typeof(DataInCreateRequest<>)] = "Data In Create [ResourceName] Request", + [typeof(AttributesInCreateRequest)] = "Attributes In Create Request", + [typeof(AttributesInCreateRequest<>)] = "Attributes In Create [ResourceName] Request", + [typeof(RelationshipsInCreateRequest)] = "Relationships In Create Request", + [typeof(RelationshipsInCreateRequest<>)] = "Relationships In Create [ResourceName] Request", + [typeof(ResourceInUpdateRequest)] = "Resource In Update Request", + [typeof(DataInUpdateRequest<>)] = "Data In Update [ResourceName] Request", + [typeof(AttributesInUpdateRequest)] = "Attributes In Update Request", + [typeof(AttributesInUpdateRequest<>)] = "Attributes In Update [ResourceName] Request", + [typeof(RelationshipsInUpdateRequest)] = "Relationships In Update Request", + [typeof(RelationshipsInUpdateRequest<>)] = "Relationships In Update [ResourceName] Request", + [typeof(ToOneInRequest<>)] = "To One [ResourceName] In Request", + [typeof(NullableToOneInRequest<>)] = "Nullable To One [ResourceName] In Request", + [typeof(ToManyInRequest<>)] = "To Many [ResourceName] In Request", + [typeof(PrimaryResponseDocument<>)] = "Primary [ResourceName] Response Document", + [typeof(SecondaryResponseDocument<>)] = "Secondary [ResourceName] Response Document", + [typeof(NullableSecondaryResponseDocument<>)] = "Nullable Secondary [ResourceName] Response Document", + [typeof(CollectionResponseDocument<>)] = "[ResourceName] Collection Response Document", + [typeof(IdentifierResponseDocument<>)] = "[ResourceName] Identifier Response Document", + [typeof(NullableIdentifierResponseDocument<>)] = "Nullable [ResourceName] Identifier Response Document", + [typeof(IdentifierCollectionResponseDocument<>)] = "[ResourceName] Identifier Collection Response Document", + [typeof(ToOneInResponse<>)] = "To One [ResourceName] In Response", + [typeof(NullableToOneInResponse<>)] = "Nullable To One [ResourceName] In Response", + [typeof(ToManyInResponse<>)] = "To Many [ResourceName] In Response", + [typeof(ResourceInResponse)] = "Resource In Response", + [typeof(DataInResponse<>)] = "Data In [ResourceName] Response", + [typeof(AttributesInResponse<>)] = "Attributes In [ResourceName] Response", + [typeof(RelationshipsInResponse<>)] = "Relationships In [ResourceName] Response", + [typeof(IdentifierInRequest)] = "Identifier In Request", + [typeof(IdentifierInRequest<>)] = "[ResourceName] Identifier In Request", + [typeof(IdentifierInResponse<>)] = "[ResourceName] Identifier In Response", + [typeof(CreateOperation<>)] = "Create [ResourceName] Operation", + [typeof(UpdateOperation<>)] = "Update [ResourceName] Operation", + [typeof(DeleteOperation<>)] = "Delete [ResourceName] Operation", + [typeof(UpdateToOneRelationshipOperation<>)] = "Temporary Update [ResourceName] To One Relationship Operation", + [typeof(UpdateToManyRelationshipOperation<>)] = "Temporary Update [ResourceName] To Many Relationship Operation", + [typeof(AddToRelationshipOperation<>)] = "Temporary Add To [ResourceName] Relationship Operation", + [typeof(RemoveFromRelationshipOperation<>)] = "Temporary Remove From [ResourceName] Relationship Operation" + }; + + private readonly IJsonApiOptions _options; + private readonly IResourceGraph _resourceGraph; + + public JsonApiSchemaIdSelector(IJsonApiOptions options, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _options = options; + _resourceGraph = resourceGraph; + } + + public string GetSchemaId(Type type) + { + ArgumentNullException.ThrowIfNull(type); + + ResourceType? resourceType = _resourceGraph.FindResourceType(type); + + if (resourceType != null) + { + return resourceType.PublicName.Singularize(); + } + + Type openType = type.ConstructedToOpenType(); + + if (openType != type) + { + if (SchemaTypeToTemplateMap.TryGetValue(openType, out string? schemaTemplate)) + { + Type resourceClrType = type.GetGenericArguments().First(); + resourceType = _resourceGraph.GetResourceType(resourceClrType); + + return ApplySchemaTemplate(schemaTemplate, resourceType, null, null); + } + } + else + { + if (SchemaTypeToTemplateMap.TryGetValue(type, out string? schemaTemplate)) + { + return ApplySchemaTemplate(schemaTemplate, null, null, null); + } + } + + // Used for a fixed set of non-generic types, such as Jsonapi, ResourceCollectionTopLevelLinks etc. + return ApplySchemaTemplate(type.Name, null, null, null); + } + + private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resourceType, string? relationshipName, AtomicOperationCode? operationCode) + { + string schemaId = schemaTemplate; + + schemaId = resourceType != null + ? schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).Pascalize() + : schemaId.Replace("[ResourceName]", "$$$").Pascalize().Replace("$$$", string.Empty); + + if (relationshipName != null) + { + schemaId = schemaId.Replace("[RelationshipName]", relationshipName.Pascalize()); + } + + if (operationCode != null) + { + schemaId = schemaId.Replace("[OperationCode]", operationCode.Value.ToString().Pascalize()); + } + + string pascalCaseSchemaId = schemaId.Pascalize(); + + JsonNamingPolicy? namingPolicy = _options.SerializerOptions.PropertyNamingPolicy; + return namingPolicy != null ? namingPolicy.ConvertName(pascalCaseSchemaId) : pascalCaseSchemaId; + } + + public string GetResourceTypeSchemaId(ResourceType? resourceType) + { + return ApplySchemaTemplate(ResourceTypeSchemaIdTemplate, resourceType, null, null); + } + + public string GetMetaSchemaId() + { + return ApplySchemaTemplate(MetaSchemaIdTemplate, null, null, null); + } + + public string GetAtomicOperationCodeSchemaId(AtomicOperationCode operationCode) + { + return ApplySchemaTemplate("[OperationCode] Operation Code", null, null, operationCode); + } + + public string GetAtomicOperationDiscriminatorValue(AtomicOperationCode operationCode, ResourceType resourceType) + { + ArgumentNullException.ThrowIfNull(resourceType); + + return ApplySchemaTemplate(ResourceAtomicOperationDiscriminatorValueTemplate, resourceType, null, operationCode); + } + + public string GetAtomicOperationDiscriminatorValue(AtomicOperationCode operationCode, RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + string schemaIdTemplate = operationCode switch + { + AtomicOperationCode.Add => AddToRelationshipAtomicOperationDiscriminatorValueTemplate, + AtomicOperationCode.Remove => RemoveFromRelationshipAtomicOperationDiscriminatorValueTemplate, + _ => UpdateRelationshipAtomicOperationDiscriminatorValueTemplate + }; + + return ApplySchemaTemplate(schemaIdTemplate, relationship.LeftType, relationship.PublicName, null); + } + + public string GetRelationshipAtomicOperationSchemaId(RelationshipAttribute relationship, AtomicOperationCode operationCode) + { + ArgumentNullException.ThrowIfNull(relationship); + + string schemaIdTemplate = operationCode switch + { + AtomicOperationCode.Add => AddToRelationshipAtomicOperationSchemaIdTemplate, + AtomicOperationCode.Remove => RemoveFromRelationshipAtomicOperationSchemaIdTemplate, + _ => UpdateRelationshipAtomicOperationSchemaIdTemplate + }; + + return ApplySchemaTemplate(schemaIdTemplate, relationship.LeftType, relationship.PublicName, null); + } + + public string GetRelationshipIdentifierSchemaId(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return ApplySchemaTemplate(RelationshipIdentifierSchemaIdTemplate, relationship.LeftType, relationship.PublicName, null); + } + + public string GetRelationshipNameSchemaId(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + return ApplySchemaTemplate(RelationshipNameSchemaIdTemplate, relationship.LeftType, relationship.PublicName, null); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ObjectExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ObjectExtensions.cs new file mode 100644 index 0000000000..accd03d7c4 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ObjectExtensions.cs @@ -0,0 +1,18 @@ +using System.Reflection; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class ObjectExtensions +{ + private static readonly Lazy MemberwiseCloneMethod = + new(() => typeof(object).GetMethod(nameof(MemberwiseClone), BindingFlags.Instance | BindingFlags.NonPublic)!, + LazyThreadSafetyMode.ExecutionAndPublication); + + public static T MemberwiseClone(this T source) + where T : class + { + ArgumentNullException.ThrowIfNull(source); + + return (T)MemberwiseCloneMethod.Value.Invoke(source, null)!; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs new file mode 100644 index 0000000000..b9cfddd772 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiApplicationBuilderEvents.cs @@ -0,0 +1,23 @@ +using JsonApiDotNetCore.Configuration; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiApplicationBuilderEvents : IJsonApiApplicationBuilderEvents +{ + private readonly IJsonApiOptions _options; + private readonly IJsonApiRequestAccessor _requestAccessor; + + public OpenApiApplicationBuilderEvents(IJsonApiOptions options, IJsonApiRequestAccessor requestAccessor) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(requestAccessor); + + _options = options; + _requestAccessor = requestAccessor; + } + + public void ResourceGraphBuilt(IResourceGraph resourceGraph) + { + _options.SerializerOptions.Converters.Add(new OpenApiResourceObjectConverter(resourceGraph, _requestAccessor)); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs new file mode 100644 index 0000000000..2678cb122e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiContentNegotiator.cs @@ -0,0 +1,71 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using Microsoft.AspNetCore.Http; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiContentNegotiator(IJsonApiOptions options, IHttpContextAccessor httpContextAccessor) + : JsonApiContentNegotiator(options, httpContextAccessor) +{ + private readonly IJsonApiOptions _options = options; + + protected override JsonApiMediaType? GetDefaultMediaType(IReadOnlyList possibleMediaTypes, JsonApiMediaType? requestMediaType) + { + if (requestMediaType != null && possibleMediaTypes.Contains(requestMediaType)) + { + // Bug workaround: NSwag doesn't send an Accept header when only non-success responses define a Content-Type. + // This occurs on POST/PATCH/DELETE at a JSON:API relationships endpoint. + return requestMediaType; + } + + return base.GetDefaultMediaType(possibleMediaTypes, requestMediaType); + } + + protected override IReadOnlyList GetPossibleMediaTypes() + { + List mediaTypes = []; + + // JSON:API compliant entries come after relaxed entries, which makes them less likely to be selected. + // This improves compatibility with client generators, which often generate broken code due to the double quotes. + + if (IsOperationsEndpoint()) + { + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.RelaxedAtomicOperations)) + { + mediaTypes.Add(JsonApiMediaType.RelaxedAtomicOperations); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.AtomicOperations)) + { + mediaTypes.Add(JsonApiMediaType.AtomicOperations); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.RelaxedAtomicOperations) && + _options.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.RelaxedAtomicOperationsWithRelaxedOpenApi); + } + + if (_options.Extensions.Contains(JsonApiMediaTypeExtension.AtomicOperations) && _options.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.AtomicOperationsWithOpenApi); + } + } + else + { + if (_options.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.RelaxedOpenApi); + } + + if (_options.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi)) + { + mediaTypes.Add(OpenApiMediaTypes.OpenApi); + } + + mediaTypes.Add(JsonApiMediaType.Default); + } + + return mediaTypes.AsReadOnly(); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiDescriptionLinkProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiDescriptionLinkProvider.cs new file mode 100644 index 0000000000..278c2154a9 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiDescriptionLinkProvider.cs @@ -0,0 +1,41 @@ +using JsonApiDotNetCore.Serialization.Response; +using Microsoft.Extensions.Options; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Provides the OpenAPI URL for the "describedby" link in https://jsonapi.org/format/#document-top-level. +/// +internal sealed class OpenApiDescriptionLinkProvider : IDocumentDescriptionLinkProvider +{ + private readonly IOptionsMonitor _swaggerGeneratorOptionsMonitor; + private readonly IOptionsMonitor _swaggerOptionsMonitor; + + public OpenApiDescriptionLinkProvider(IOptionsMonitor swaggerGeneratorOptionsMonitor, + IOptionsMonitor swaggerOptionsMonitor) + { + ArgumentNullException.ThrowIfNull(swaggerGeneratorOptionsMonitor); + ArgumentNullException.ThrowIfNull(swaggerOptionsMonitor); + + _swaggerGeneratorOptionsMonitor = swaggerGeneratorOptionsMonitor; + _swaggerOptionsMonitor = swaggerOptionsMonitor; + } + + /// + public string? GetUrl() + { + SwaggerGeneratorOptions swaggerGeneratorOptions = _swaggerGeneratorOptionsMonitor.CurrentValue; + + if (swaggerGeneratorOptions.SwaggerDocs.Count > 0) + { + string latestVersionDocumentName = swaggerGeneratorOptions.SwaggerDocs.Last().Key; + + SwaggerOptions swaggerOptions = _swaggerOptionsMonitor.CurrentValue; + return swaggerOptions.RouteTemplate.Replace("{documentName}", latestVersionDocumentName).Replace("{extension:regex(^(json|ya?ml)$)}", "json"); + } + + return null; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs new file mode 100644 index 0000000000..75649b85a8 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs @@ -0,0 +1,348 @@ +using System.Net; +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApplicationModels; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Sets metadata on controllers for OpenAPI documentation generation by Swagger. Only targets JsonApiDotNetCore controllers. +/// +internal sealed class OpenApiEndpointConvention : IActionModelConvention +{ + private readonly IControllerResourceMapping _controllerResourceMapping; + private readonly IJsonApiOptions _options; + + public OpenApiEndpointConvention(IControllerResourceMapping controllerResourceMapping, IJsonApiOptions options) + { + ArgumentNullException.ThrowIfNull(controllerResourceMapping); + ArgumentNullException.ThrowIfNull(options); + + _controllerResourceMapping = controllerResourceMapping; + _options = options; + } + + public void Apply(ActionModel action) + { + ArgumentNullException.ThrowIfNull(action); + + JsonApiEndpointWrapper endpoint = JsonApiEndpointWrapper.FromActionModel(action); + + if (endpoint.IsUnknown) + { + // Not a JSON:API controller, or a non-standard action method in a JSON:API controller. + // None of these are yet implemented, so hide them to avoid downstream crashes. + action.ApiExplorer.IsVisible = false; + return; + } + + ResourceType? resourceType = _controllerResourceMapping.GetResourceTypeForController(action.Controller.ControllerType); + + if (ShouldSuppressEndpoint(endpoint, resourceType)) + { + action.ApiExplorer.IsVisible = false; + return; + } + + SetResponseMetadata(action, endpoint, resourceType); + SetRequestMetadata(action, endpoint); + } + + private bool ShouldSuppressEndpoint(JsonApiEndpointWrapper endpoint, ResourceType? resourceType) + { + if (resourceType == null) + { + return false; + } + + if (!IsEndpointAvailable(endpoint.Value, resourceType)) + { + return true; + } + + if (IsSecondaryOrRelationshipEndpoint(endpoint.Value)) + { + if (resourceType.Relationships.Count == 0) + { + return true; + } + + if (endpoint.Value is JsonApiEndpoints.DeleteRelationship or JsonApiEndpoints.PostRelationship) + { + return !resourceType.Relationships.OfType().Any(); + } + } + + return false; + } + + private static bool IsEndpointAvailable(JsonApiEndpoints endpoint, ResourceType resourceType) + { + JsonApiEndpoints availableEndpoints = GetGeneratedControllerEndpoints(resourceType); + + if (availableEndpoints == JsonApiEndpoints.None) + { + // Auto-generated controllers are disabled, so we can't know what to hide. + // It is assumed that a handwritten JSON:API controller only provides action methods for what it supports. + // To accomplish that, derive from BaseJsonApiController instead of JsonApiController. + return true; + } + + // For an overridden JSON:API action method in a partial class to show up, it's flag must be turned on in [Resource]. + // Otherwise, it is considered to be an action method that throws because the endpoint is unavailable. + return IncludesEndpoint(endpoint, availableEndpoints); + } + + private static bool IncludesEndpoint(JsonApiEndpoints endpoint, JsonApiEndpoints availableEndpoints) + { + bool? isIncluded = null; + + if (endpoint == JsonApiEndpoints.GetCollection) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.GetCollection); + } + else if (endpoint == JsonApiEndpoints.GetSingle) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.GetSingle); + } + else if (endpoint == JsonApiEndpoints.GetSecondary) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.GetSecondary); + } + else if (endpoint == JsonApiEndpoints.GetRelationship) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.GetRelationship); + } + else if (endpoint == JsonApiEndpoints.Post) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.Post); + } + else if (endpoint == JsonApiEndpoints.PostRelationship) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.PostRelationship); + } + else if (endpoint == JsonApiEndpoints.Patch) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.Patch); + } + else if (endpoint == JsonApiEndpoints.PatchRelationship) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.PatchRelationship); + } + else if (endpoint == JsonApiEndpoints.Delete) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.Delete); + } + else if (endpoint == JsonApiEndpoints.DeleteRelationship) + { + isIncluded = availableEndpoints.HasFlag(JsonApiEndpoints.DeleteRelationship); + } + + ConsistencyGuard.ThrowIf(isIncluded == null); + return isIncluded.Value; + } + + private static JsonApiEndpoints GetGeneratedControllerEndpoints(ResourceType resourceType) + { + var resourceAttribute = resourceType.ClrType.GetCustomAttribute(); + return resourceAttribute?.GenerateControllerEndpoints ?? JsonApiEndpoints.None; + } + + private static bool IsSecondaryOrRelationshipEndpoint(JsonApiEndpoints endpoint) + { + return endpoint is JsonApiEndpoints.GetSecondary or JsonApiEndpoints.GetRelationship or JsonApiEndpoints.PostRelationship or + JsonApiEndpoints.PatchRelationship or JsonApiEndpoints.DeleteRelationship; + } + + private void SetResponseMetadata(ActionModel action, JsonApiEndpointWrapper endpoint, ResourceType? resourceType) + { + JsonApiMediaType mediaType = GetMediaTypeForEndpoint(endpoint); + action.Filters.Add(new ProducesAttribute(mediaType.ToString())); + + foreach (HttpStatusCode statusCode in GetSuccessStatusCodesForEndpoint(endpoint)) + { + // The return type is set later by JsonApiActionDescriptorCollectionProvider. + action.Filters.Add(new ProducesResponseTypeAttribute((int)statusCode)); + } + + foreach (HttpStatusCode statusCode in GetErrorStatusCodesForEndpoint(endpoint, resourceType)) + { + action.Filters.Add(new ProducesResponseTypeAttribute(typeof(ErrorResponseDocument), (int)statusCode)); + } + } + + private JsonApiMediaType GetMediaTypeForEndpoint(JsonApiEndpointWrapper endpoint) + { + return endpoint.IsAtomicOperationsEndpoint ? OpenApiMediaTypes.RelaxedAtomicOperationsWithRelaxedOpenApi : OpenApiMediaTypes.RelaxedOpenApi; + } + + private static HttpStatusCode[] GetSuccessStatusCodesForEndpoint(JsonApiEndpointWrapper endpoint) + { + if (endpoint.IsAtomicOperationsEndpoint) + { + return + [ + HttpStatusCode.OK, + HttpStatusCode.NoContent + ]; + } + + HttpStatusCode[]? statusCodes = null; + + if (endpoint.Value is JsonApiEndpoints.GetCollection or JsonApiEndpoints.GetSingle or JsonApiEndpoints.GetSecondary or JsonApiEndpoints.GetRelationship) + { + statusCodes = + [ + HttpStatusCode.OK, + HttpStatusCode.NotModified + ]; + } + else if (endpoint.Value == JsonApiEndpoints.Post) + { + statusCodes = + [ + HttpStatusCode.Created, + HttpStatusCode.NoContent + ]; + } + else if (endpoint.Value == JsonApiEndpoints.Patch) + { + statusCodes = + [ + HttpStatusCode.OK, + HttpStatusCode.NoContent + ]; + } + else if (endpoint.Value is JsonApiEndpoints.Delete or JsonApiEndpoints.PostRelationship or JsonApiEndpoints.PatchRelationship or + JsonApiEndpoints.DeleteRelationship) + { + statusCodes = [HttpStatusCode.NoContent]; + } + + ConsistencyGuard.ThrowIf(statusCodes == null); + return statusCodes; + } + + private HttpStatusCode[] GetErrorStatusCodesForEndpoint(JsonApiEndpointWrapper endpoint, ResourceType? resourceType) + { + if (endpoint.IsAtomicOperationsEndpoint) + { + return + [ + HttpStatusCode.BadRequest, + HttpStatusCode.Forbidden, + HttpStatusCode.NotFound, + HttpStatusCode.Conflict, + HttpStatusCode.UnprocessableEntity + ]; + } + + // Condition doesn't apply to atomic operations, because Forbidden is also used when an operation is not accessible. + ClientIdGenerationMode clientIdGeneration = resourceType?.ClientIdGeneration ?? _options.ClientIdGeneration; + + HttpStatusCode[]? statusCodes = null; + + if (endpoint.Value == JsonApiEndpoints.GetCollection) + { + statusCodes = [HttpStatusCode.BadRequest]; + } + else if (endpoint.Value is JsonApiEndpoints.GetSingle or JsonApiEndpoints.GetSecondary or JsonApiEndpoints.GetRelationship) + { + statusCodes = + [ + HttpStatusCode.BadRequest, + HttpStatusCode.NotFound + ]; + } + else if (endpoint.Value == JsonApiEndpoints.Post && clientIdGeneration == ClientIdGenerationMode.Forbidden) + { + statusCodes = + [ + HttpStatusCode.BadRequest, + HttpStatusCode.Forbidden, + HttpStatusCode.NotFound, + HttpStatusCode.Conflict, + HttpStatusCode.UnprocessableEntity + ]; + } + else if (endpoint.Value is JsonApiEndpoints.Post or JsonApiEndpoints.Patch) + { + statusCodes = + [ + HttpStatusCode.BadRequest, + HttpStatusCode.NotFound, + HttpStatusCode.Conflict, + HttpStatusCode.UnprocessableEntity + ]; + } + else if (endpoint.Value == JsonApiEndpoints.Delete) + { + statusCodes = [HttpStatusCode.NotFound]; + } + else if (endpoint.Value is JsonApiEndpoints.PostRelationship or JsonApiEndpoints.PatchRelationship or JsonApiEndpoints.DeleteRelationship) + { + statusCodes = + [ + HttpStatusCode.BadRequest, + HttpStatusCode.NotFound, + HttpStatusCode.Conflict, + HttpStatusCode.UnprocessableEntity + ]; + } + + ConsistencyGuard.ThrowIf(statusCodes == null); + return statusCodes; + } + + private void SetRequestMetadata(ActionModel action, JsonApiEndpointWrapper endpoint) + { + if (RequiresRequestBody(endpoint)) + { + JsonApiMediaType mediaType = GetMediaTypeForEndpoint(endpoint); + action.Filters.Add(new ConsumesAttribute(mediaType.ToString())); + } + } + + private static bool RequiresRequestBody(JsonApiEndpointWrapper endpoint) + { + return endpoint.IsAtomicOperationsEndpoint || endpoint.Value is JsonApiEndpoints.Post or JsonApiEndpoints.Patch or JsonApiEndpoints.PostRelationship or + JsonApiEndpoints.PatchRelationship or JsonApiEndpoints.DeleteRelationship; + } + + private sealed class JsonApiEndpointWrapper + { + private static readonly JsonApiEndpointWrapper AtomicOperations = new(true, JsonApiEndpoints.None); + + public bool IsAtomicOperationsEndpoint { get; } + public JsonApiEndpoints Value { get; } + public bool IsUnknown => !IsAtomicOperationsEndpoint && Value == JsonApiEndpoints.None; + + private JsonApiEndpointWrapper(bool isAtomicOperationsEndpoint, JsonApiEndpoints value) + { + IsAtomicOperationsEndpoint = isAtomicOperationsEndpoint; + Value = value; + } + + public static JsonApiEndpointWrapper FromActionModel(ActionModel actionModel) + { + if (EndpointResolver.Instance.IsAtomicOperationsController(actionModel.ActionMethod)) + { + return AtomicOperations; + } + + JsonApiEndpoints endpoint = EndpointResolver.Instance.GetEndpoint(actionModel.ActionMethod); + return new JsonApiEndpointWrapper(false, endpoint); + } + + public override string ToString() + { + return IsAtomicOperationsEndpoint ? "PostOperations" : Value.ToString(); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs new file mode 100644 index 0000000000..64abe96e97 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypeExtension.cs @@ -0,0 +1,14 @@ +using JsonApiDotNetCore.Middleware; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +#pragma warning disable AV1008 // Class should not be static + +internal static class OpenApiMediaTypeExtension +{ + public const string ExtensionNamespace = "openapi"; + public const string DiscriminatorPropertyName = "discriminator"; + public const string FullyQualifiedOpenApiDiscriminatorPropertyName = $"{ExtensionNamespace}:{DiscriminatorPropertyName}"; + public static readonly JsonApiMediaTypeExtension OpenApi = new("https://www.jsonapi.net/ext/openapi"); + public static readonly JsonApiMediaTypeExtension RelaxedOpenApi = new("openapi"); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs new file mode 100644 index 0000000000..29cc134c34 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiMediaTypes.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Middleware; + +#pragma warning disable AV1008 // Class should not be static + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class OpenApiMediaTypes +{ + public static readonly JsonApiMediaType OpenApi = new([OpenApiMediaTypeExtension.OpenApi]); + public static readonly JsonApiMediaType RelaxedOpenApi = new([OpenApiMediaTypeExtension.RelaxedOpenApi]); + + public static readonly JsonApiMediaType AtomicOperationsWithOpenApi = new([ + JsonApiMediaTypeExtension.AtomicOperations, + OpenApiMediaTypeExtension.OpenApi + ]); + + public static readonly JsonApiMediaType RelaxedAtomicOperationsWithRelaxedOpenApi = new([ + JsonApiMediaTypeExtension.RelaxedAtomicOperations, + OpenApiMediaTypeExtension.RelaxedOpenApi + ]); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs new file mode 100644 index 0000000000..ed11481e27 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs @@ -0,0 +1,109 @@ +using System.Reflection; +using System.Text.Json; +using Humanizer; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Controllers; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiOperationIdSelector +{ + private const string ResourceIdTemplate = "[Method] [PrimaryResourceName]"; + private const string ResourceCollectionIdTemplate = $"{ResourceIdTemplate} Collection"; + private const string SecondaryResourceIdTemplate = $"{ResourceIdTemplate} [RelationshipName]"; + private const string RelationshipIdTemplate = $"{SecondaryResourceIdTemplate} Relationship"; + private const string AtomicOperationsIdTemplate = "[Method] Operations"; + + private static readonly Dictionary SchemaOpenTypeToOpenApiOperationIdTemplateMap = new() + { + [typeof(CollectionResponseDocument<>)] = ResourceCollectionIdTemplate, + [typeof(PrimaryResponseDocument<>)] = ResourceIdTemplate, + [typeof(CreateRequestDocument<>)] = ResourceIdTemplate, + [typeof(UpdateRequestDocument<>)] = ResourceIdTemplate, + [typeof(void)] = ResourceIdTemplate, + [typeof(SecondaryResponseDocument<>)] = SecondaryResourceIdTemplate, + [typeof(NullableSecondaryResponseDocument<>)] = SecondaryResourceIdTemplate, + [typeof(IdentifierCollectionResponseDocument<>)] = RelationshipIdTemplate, + [typeof(IdentifierResponseDocument<>)] = RelationshipIdTemplate, + [typeof(NullableIdentifierResponseDocument<>)] = RelationshipIdTemplate, + [typeof(ToOneInRequest<>)] = RelationshipIdTemplate, + [typeof(NullableToOneInRequest<>)] = RelationshipIdTemplate, + [typeof(ToManyInRequest<>)] = RelationshipIdTemplate, + [typeof(OperationsRequestDocument)] = AtomicOperationsIdTemplate + }; + + private readonly IControllerResourceMapping _controllerResourceMapping; + private readonly IJsonApiOptions _options; + + public OpenApiOperationIdSelector(IControllerResourceMapping controllerResourceMapping, IJsonApiOptions options) + { + ArgumentNullException.ThrowIfNull(controllerResourceMapping); + ArgumentNullException.ThrowIfNull(options); + + _controllerResourceMapping = controllerResourceMapping; + _options = options; + } + + public string GetOpenApiOperationId(ApiDescription endpoint) + { + ArgumentNullException.ThrowIfNull(endpoint); + + MethodInfo actionMethod = endpoint.ActionDescriptor.GetActionMethod(); + ResourceType? primaryResourceType = _controllerResourceMapping.GetResourceTypeForController(actionMethod.ReflectedType); + + string template = GetTemplate(endpoint); + return ApplyTemplate(template, primaryResourceType, endpoint); + } + + private static string GetTemplate(ApiDescription endpoint) + { + Type bodyType = GetBodyType(endpoint); + ConsistencyGuard.ThrowIf(!SchemaOpenTypeToOpenApiOperationIdTemplateMap.TryGetValue(bodyType, out string? template)); + return template; + } + + private static Type GetBodyType(ApiDescription endpoint) + { + var producesResponseTypeAttribute = endpoint.ActionDescriptor.GetFilterMetadata(); + ConsistencyGuard.ThrowIf(producesResponseTypeAttribute == null); + + ControllerParameterDescriptor? requestBodyDescriptor = endpoint.ActionDescriptor.GetBodyParameterDescriptor(); + Type bodyType = (requestBodyDescriptor?.ParameterType ?? producesResponseTypeAttribute.Type).ConstructedToOpenType(); + + if (bodyType == typeof(CollectionResponseDocument<>) && endpoint.ParameterDescriptions.Count > 0) + { + bodyType = typeof(SecondaryResponseDocument<>); + } + + return bodyType; + } + + private string ApplyTemplate(string openApiOperationIdTemplate, ResourceType? resourceType, ApiDescription endpoint) + { + ConsistencyGuard.ThrowIf(endpoint.RelativePath == null); + ConsistencyGuard.ThrowIf(endpoint.HttpMethod == null); + + string method = endpoint.HttpMethod.ToLowerInvariant(); + string relationshipName = openApiOperationIdTemplate.Contains("[RelationshipName]") ? endpoint.RelativePath.Split('/').Last() : string.Empty; + + // @formatter:wrap_chained_method_calls chop_always + // @formatter:wrap_before_first_method_call true + + string pascalCaseOpenApiOperationId = openApiOperationIdTemplate + .Replace("[Method]", method) + .Replace("[PrimaryResourceName]", resourceType?.PublicName.Singularize()) + .Replace("[RelationshipName]", relationshipName) + .Pascalize(); + + // @formatter:wrap_before_first_method_call true restore + // @formatter:wrap_chained_method_calls restore + + JsonNamingPolicy? namingPolicy = _options.SerializerOptions.PropertyNamingPolicy; + return namingPolicy != null ? namingPolicy.ConvertName(pascalCaseOpenApiOperationId) : pascalCaseOpenApiOperationId; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs new file mode 100644 index 0000000000..dd7c9503e7 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiResourceObjectConverter.cs @@ -0,0 +1,106 @@ +using System.Net; +using System.Text.Json; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Errors; +using JsonApiDotNetCore.Serialization.JsonConverters; +using JsonApiDotNetCore.Serialization.Objects; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class OpenApiResourceObjectConverter : ResourceObjectConverter +{ + private readonly IJsonApiRequestAccessor _requestAccessor; + + private bool HasOpenApiExtension + { + get + { + if (_requestAccessor.Current == null) + { + return false; + } + + return _requestAccessor.Current.Extensions.Contains(OpenApiMediaTypeExtension.OpenApi) || + _requestAccessor.Current.Extensions.Contains(OpenApiMediaTypeExtension.RelaxedOpenApi); + } + } + + public OpenApiResourceObjectConverter(IResourceGraph resourceGraph, IJsonApiRequestAccessor requestAccessor) + : base(resourceGraph) + { + ArgumentNullException.ThrowIfNull(requestAccessor); + + _requestAccessor = requestAccessor; + } + + private protected override void ValidateExtensionInAttributes(string extensionNamespace, string extensionName, ResourceType resourceType, + Utf8JsonReader reader) + { + if (IsOpenApiDiscriminator(extensionNamespace, extensionName)) + { + const string jsonPointer = $"attributes/{OpenApiMediaTypeExtension.ExtensionNamespace}:{OpenApiMediaTypeExtension.DiscriminatorPropertyName}"; + ValidateOpenApiDiscriminatorValue(resourceType, jsonPointer, reader); + } + else + { + base.ValidateExtensionInAttributes(extensionNamespace, extensionName, resourceType, reader); + } + } + + private protected override void ValidateExtensionInRelationships(string extensionNamespace, string extensionName, ResourceType resourceType, + Utf8JsonReader reader) + { + if (IsOpenApiDiscriminator(extensionNamespace, extensionName)) + { + const string jsonPointer = $"relationships/{OpenApiMediaTypeExtension.ExtensionNamespace}:{OpenApiMediaTypeExtension.DiscriminatorPropertyName}"; + ValidateOpenApiDiscriminatorValue(resourceType, jsonPointer, reader); + } + else + { + base.ValidateExtensionInRelationships(extensionNamespace, extensionName, resourceType, reader); + } + } + + private protected override void WriteExtensionInAttributes(Utf8JsonWriter writer, ResourceObject value) + { + if (HasOpenApiExtension) + { + writer.WriteString(OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, value.Type); + } + } + + private protected override void WriteExtensionInRelationships(Utf8JsonWriter writer, ResourceObject value) + { + if (HasOpenApiExtension) + { + writer.WriteString(OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, value.Type); + } + } + + private bool IsOpenApiDiscriminator(string extensionNamespace, string extensionName) + { + return HasOpenApiExtension && extensionNamespace == OpenApiMediaTypeExtension.ExtensionNamespace && + extensionName == OpenApiMediaTypeExtension.DiscriminatorPropertyName; + } + + private static void ValidateOpenApiDiscriminatorValue(ResourceType resourceType, string relativeJsonPointer, Utf8JsonReader reader) + { + string? discriminatorValue = reader.GetString(); + + if (discriminatorValue != resourceType.PublicName) + { + var jsonApiException = new JsonApiException(new ErrorObject(HttpStatusCode.Conflict) + { + Title = "Incompatible resource type found.", + Detail = + $"Expected {OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName} with value '{resourceType.PublicName}' instead of '{discriminatorValue}'.", + Source = new ErrorSource + { + Pointer = relativeJsonPointer + } + }); + + CapturedThrow(jsonApiException); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiSchemaExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiSchemaExtensions.cs new file mode 100644 index 0000000000..10095834b2 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiSchemaExtensions.cs @@ -0,0 +1,48 @@ +using Microsoft.OpenApi.Models; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class OpenApiSchemaExtensions +{ + public static void ReorderProperties(this OpenApiSchema fullSchema, IEnumerable propertyNamesInOrder) + { + ArgumentNullException.ThrowIfNull(fullSchema); + ArgumentNullException.ThrowIfNull(propertyNamesInOrder); + + var propertiesInOrder = new Dictionary(); + + foreach (string propertyName in propertyNamesInOrder) + { + if (fullSchema.Properties.TryGetValue(propertyName, out OpenApiSchema? schema)) + { + propertiesInOrder.Add(propertyName, schema); + } + } + + ConsistencyGuard.ThrowIf(fullSchema.Properties.Count != propertiesInOrder.Count); + + fullSchema.Properties = propertiesInOrder; + } + + public static OpenApiSchema WrapInExtendedSchema(this OpenApiSchema source) + { + ArgumentNullException.ThrowIfNull(source); + + return new OpenApiSchema + { + AllOf = [source] + }; + } + + public static OpenApiSchema UnwrapLastExtendedSchema(this OpenApiSchema source) + { + ArgumentNullException.ThrowIfNull(source); + + if (source.AllOf is { Count: > 0 }) + { + return source.AllOf.Last(); + } + + return source; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ParameterInfoWrapper.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ParameterInfoWrapper.cs new file mode 100644 index 0000000000..a785de0452 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ParameterInfoWrapper.cs @@ -0,0 +1,78 @@ +using System.Reflection; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Used for parameters in action method expansion. Changes the parameter name and type, while still using all metadata of the underlying non-expanded +/// parameter. +/// +internal sealed class ParameterInfoWrapper : ParameterInfo +{ + private readonly ParameterInfo _innerParameter; + + public override ParameterAttributes Attributes => _innerParameter.Attributes; + public override IEnumerable CustomAttributes => _innerParameter.CustomAttributes; + public override object? DefaultValue => _innerParameter.DefaultValue; + public override bool HasDefaultValue => _innerParameter.HasDefaultValue; + public override MemberInfo Member => _innerParameter.Member; + public override int MetadataToken => _innerParameter.MetadataToken; + public override string? Name { get; } + public override Type ParameterType { get; } + public override int Position => _innerParameter.Position; + public override object? RawDefaultValue => _innerParameter.RawDefaultValue; + + public ParameterInfoWrapper(ParameterInfo innerParameter, Type overriddenParameterType, string? overriddenName) + { + ArgumentNullException.ThrowIfNull(innerParameter); + ArgumentNullException.ThrowIfNull(overriddenParameterType); + + _innerParameter = innerParameter; + ParameterType = overriddenParameterType; + Name = overriddenName; + } + + public override object[] GetCustomAttributes(bool inherit) + { + return _innerParameter.GetCustomAttributes(inherit); + } + + public override object[] GetCustomAttributes(Type attributeType, bool inherit) + { + return _innerParameter.GetCustomAttributes(attributeType, inherit); + } + + public override bool IsDefined(Type attributeType, bool inherit) + { + return _innerParameter.IsDefined(attributeType, inherit); + } + + public override bool Equals(object? obj) + { + return _innerParameter.Equals(obj); + } + + public override int GetHashCode() + { + return _innerParameter.GetHashCode(); + } + + public override string ToString() + { + return _innerParameter.ToString(); + } + + public override IList GetCustomAttributesData() + { + return _innerParameter.GetCustomAttributesData(); + } + + public override Type[] GetOptionalCustomModifiers() + { + return _innerParameter.GetOptionalCustomModifiers(); + } + + public override Type[] GetRequiredCustomModifiers() + { + return _innerParameter.GetRequiredCustomModifiers(); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ResourceFieldValidationMetadataProvider.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ResourceFieldValidationMetadataProvider.cs new file mode 100644 index 0000000000..f0ce60c730 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ResourceFieldValidationMetadataProvider.cs @@ -0,0 +1,81 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal sealed class ResourceFieldValidationMetadataProvider +{ + private readonly IJsonApiOptions _options; + private readonly IModelMetadataProvider _modelMetadataProvider; + + public ResourceFieldValidationMetadataProvider(IJsonApiOptions options, IModelMetadataProvider modelMetadataProvider) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(modelMetadataProvider); + + _options = options; + _modelMetadataProvider = modelMetadataProvider; + } + + public bool IsNullable(ResourceFieldAttribute field) + { + ArgumentNullException.ThrowIfNull(field); + + if (field is HasManyAttribute) + { + return false; + } + + bool hasRequiredAttribute = field.Property.HasAttribute(); + + if (_options.ValidateModelState && hasRequiredAttribute) + { + return false; + } + + NullabilityInfoContext nullabilityContext = new(); + NullabilityInfo nullabilityInfo = nullabilityContext.Create(field.Property); + return nullabilityInfo.ReadState != NullabilityState.NotNull; + } + + public bool IsRequired(ResourceFieldAttribute field) + { + ArgumentNullException.ThrowIfNull(field); + + bool hasRequiredAttribute = field.Property.HasAttribute(); + + if (!_options.ValidateModelState) + { + return hasRequiredAttribute; + } + + if (field is HasManyAttribute) + { + return false; + } + + NullabilityInfoContext nullabilityContext = new(); + NullabilityInfo nullabilityInfo = nullabilityContext.Create(field.Property); + bool isRequiredValueType = field.Property.PropertyType.IsValueType && hasRequiredAttribute && nullabilityInfo.ReadState == NullabilityState.NotNull; + + if (isRequiredValueType) + { + // Special case: ASP.NET ModelState Validation effectively ignores value types with [Required]. + return false; + } + + return IsModelStateValidationRequired(field); + } + + private bool IsModelStateValidationRequired(ResourceFieldAttribute field) + { + ModelMetadata modelMetadata = _modelMetadataProvider.GetMetadataForProperty(field.Type.ClrType, field.Property.Name); + + // Non-nullable reference types are implicitly required, unless SuppressImplicitRequiredAttributeForNonNullableReferenceTypes is set. + return modelMetadata.ValidatorMetadata.Any(validatorMetadata => validatorMetadata is RequiredAttribute); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerationTracer.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerationTracer.cs new file mode 100644 index 0000000000..6dbd6bb2f3 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerationTracer.cs @@ -0,0 +1,153 @@ +using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Serialization.Objects; +using Microsoft.Extensions.Logging; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Enables to log recursive component schema generation at trace level. +/// +internal sealed partial class SchemaGenerationTracer +{ + private readonly ILoggerFactory _loggerFactory; + + public SchemaGenerationTracer(ILoggerFactory loggerFactory) + { + ArgumentNullException.ThrowIfNull(loggerFactory); + + _loggerFactory = loggerFactory; + } + + public ISchemaGenerationTraceScope TraceStart(object generator) + { + ArgumentNullException.ThrowIfNull(generator); + + return InnerTraceStart(generator, () => "(none)"); + } + + public ISchemaGenerationTraceScope TraceStart(object generator, Type schemaType) + { + ArgumentNullException.ThrowIfNull(generator); + ArgumentNullException.ThrowIfNull(schemaType); + + return InnerTraceStart(generator, () => GetSchemaTypeName(schemaType)); + } + + public ISchemaGenerationTraceScope TraceStart(object generator, AtomicOperationCode operationCode) + { + ArgumentNullException.ThrowIfNull(generator); + + return InnerTraceStart(generator, () => $"{nameof(AtomicOperationCode)}.{operationCode}"); + } + + public ISchemaGenerationTraceScope TraceStart(object generator, RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(generator); + ArgumentNullException.ThrowIfNull(relationship); + + return InnerTraceStart(generator, + () => $"{GetSchemaTypeName(relationship.GetType())}({GetSchemaTypeName(relationship.LeftType.ClrType)}.{relationship.Property.Name})"); + } + + public ISchemaGenerationTraceScope TraceStart(object generator, Type schemaOpenType, RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(generator); + ArgumentNullException.ThrowIfNull(schemaOpenType); + ArgumentNullException.ThrowIfNull(relationship); + + return InnerTraceStart(generator, + () => + $"{GetSchemaTypeName(schemaOpenType)} with {GetSchemaTypeName(relationship.GetType())}({GetSchemaTypeName(relationship.LeftType.ClrType)}.{relationship.Property.Name})"); + } + + private ISchemaGenerationTraceScope InnerTraceStart(object generator, Func getSchemaTypeName) + { + ILogger logger = _loggerFactory.CreateLogger(generator.GetType()); + + if (logger.IsEnabled(LogLevel.Trace)) + { + string schemaTypeName = getSchemaTypeName(); + return new SchemaGenerationTraceScope(logger, schemaTypeName); + } + + return DisabledSchemaGenerationTraceScope.Instance; + } + + private static string GetSchemaTypeName(Type type) + { + if (type.IsConstructedGenericType) + { + string typeArguments = string.Join(',', type.GetGenericArguments().Select(GetSchemaTypeName)); + int arityIndex = type.Name.IndexOf('`'); + return $"{type.Name[..arityIndex]}<{typeArguments}>"; + } + + return type.Name; + } + + private sealed partial class SchemaGenerationTraceScope : ISchemaGenerationTraceScope + { + private static readonly AsyncLocal RecursionDepthAsyncLocal = new(); + + private readonly ILogger _logger; + private readonly string _schemaTypeName; + private string? _schemaId; + + public SchemaGenerationTraceScope(ILogger logger, string schemaTypeName) + { + ArgumentNullException.ThrowIfNull(logger); + ArgumentNullException.ThrowIfNull(schemaTypeName); + + _logger = logger; + _schemaTypeName = schemaTypeName; + + RecursionDepthAsyncLocal.Value++; + LogStarted(RecursionDepthAsyncLocal.Value, _schemaTypeName); + } + + public void TraceSucceeded(string schemaId) + { + _schemaId = schemaId; + } + + public void Dispose() + { + if (_schemaId != null) + { + LogSucceeded(RecursionDepthAsyncLocal.Value, _schemaTypeName, _schemaId); + } + else + { + LogFailed(RecursionDepthAsyncLocal.Value, _schemaTypeName); + } + + RecursionDepthAsyncLocal.Value--; + } + + [LoggerMessage(Level = LogLevel.Trace, SkipEnabledCheck = true, Message = "({Depth:D2}) Started for {SchemaTypeName}.")] + private partial void LogStarted(int depth, string schemaTypeName); + + [LoggerMessage(Level = LogLevel.Trace, SkipEnabledCheck = true, Message = "({Depth:D2}) Generated '{SchemaId}' from {SchemaTypeName}.")] + private partial void LogSucceeded(int depth, string schemaTypeName, string schemaId); + + [LoggerMessage(Level = LogLevel.Trace, SkipEnabledCheck = true, Message = "({Depth:D2}) Failed for {SchemaTypeName}.")] + private partial void LogFailed(int depth, string schemaTypeName); + } + + private sealed class DisabledSchemaGenerationTraceScope : ISchemaGenerationTraceScope + { + public static DisabledSchemaGenerationTraceScope Instance { get; } = new(); + + private DisabledSchemaGenerationTraceScope() + { + } + + public void TraceSucceeded(string schemaId) + { + } + + public void Dispose() + { + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AtomicOperationCodeSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AtomicOperationCodeSchemaGenerator.cs new file mode 100644 index 0000000000..78a25da441 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/AtomicOperationCodeSchemaGenerator.cs @@ -0,0 +1,55 @@ +using JsonApiDotNetCore.Serialization.Objects; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class AtomicOperationCodeSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + + public AtomicOperationCodeSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, JsonApiSchemaIdSelector schemaIdSelector) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + + _schemaGenerationTracer = schemaGenerationTracer; + _schemaIdSelector = schemaIdSelector; + } + + public OpenApiSchema GenerateSchema(AtomicOperationCode operationCode, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + + string schemaId = _schemaIdSelector.GetAtomicOperationCodeSchemaId(operationCode); + + if (schemaRepository.Schemas.ContainsKey(schemaId)) + { + return new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = schemaId, + Type = ReferenceType.Schema + } + }; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, operationCode); + + string enumValue = operationCode.ToString().ToLowerInvariant(); + + var fullSchema = new OpenApiSchema + { + Type = "string", + Enum = [new OpenApiString(enumValue)] + }; + + OpenApiSchema referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs new file mode 100644 index 0000000000..c4b41dd0f5 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataContainerSchemaGenerator.cs @@ -0,0 +1,109 @@ +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +/// +/// Generates the reference schema for the Data property in a request or response schema, taking schema inheritance into account. +/// +internal sealed class DataContainerSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly DataSchemaGenerator _dataSchemaGenerator; + private readonly IResourceGraph _resourceGraph; + + public DataContainerSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, DataSchemaGenerator dataSchemaGenerator, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(dataSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _schemaGenerationTracer = schemaGenerationTracer; + _dataSchemaGenerator = dataSchemaGenerator; + _resourceGraph = resourceGraph; + } + + public OpenApiSchema GenerateSchemaForCommonResourceDataInResponse(SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + + return _dataSchemaGenerator.GenerateSchemaForCommonData(typeof(ResourceInResponse), schemaRepository); + } + + public OpenApiSchema GenerateSchema(Type dataContainerSchemaType, ResourceType resourceType, bool forRequestSchema, bool canIncludeRelated, + SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(dataContainerSchemaType); + ArgumentNullException.ThrowIfNull(resourceType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(dataContainerSchemaType, out OpenApiSchema referenceSchemaForData)) + { + return referenceSchemaForData; + } + + Type dataConstructedType = GetElementTypeOfDataProperty(dataContainerSchemaType, resourceType); + + if (schemaRepository.TryLookupByType(dataConstructedType, out _)) + { + return referenceSchemaForData; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, dataConstructedType); + + if (canIncludeRelated) + { + var resourceSchemaType = ResourceSchemaType.Create(dataConstructedType, _resourceGraph); + + if (resourceSchemaType.SchemaOpenType == typeof(DataInResponse<>)) + { + // Ensure all reachable related resource types in response schemas are generated upfront. + // This is needed to make includes work when not all endpoints are exposed. + GenerateReachableRelatedTypesInResponse(dataConstructedType, schemaRepository); + } + } + + referenceSchemaForData = _dataSchemaGenerator.GenerateSchema(dataConstructedType, forRequestSchema, schemaRepository); + traceScope.TraceSucceeded(referenceSchemaForData.Reference.Id); + return referenceSchemaForData; + } + + private static Type GetElementTypeOfDataProperty(Type dataContainerConstructedType, ResourceType resourceType) + { + PropertyInfo? dataProperty = dataContainerConstructedType.GetProperty("Data"); + ConsistencyGuard.ThrowIf(dataProperty == null); + + Type innerPropertyType = dataProperty.PropertyType.ConstructedToOpenType().IsAssignableTo(typeof(ICollection<>)) + ? dataProperty.PropertyType.GenericTypeArguments[0] + : dataProperty.PropertyType; + + if (innerPropertyType == typeof(ResourceInResponse)) + { + return typeof(DataInResponse<>).MakeGenericType(resourceType.ClrType); + } + + ConsistencyGuard.ThrowIf(!innerPropertyType.IsGenericType); + + return innerPropertyType; + } + + private void GenerateReachableRelatedTypesInResponse(Type dataConstructedType, SchemaRepository schemaRepository) + { + Type dataOpenType = dataConstructedType.GetGenericTypeDefinition(); + + if (dataOpenType == typeof(DataInResponse<>)) + { + var resourceSchemaType = ResourceSchemaType.Create(dataConstructedType, _resourceGraph); + + foreach (ResourceType relatedType in IncludeDependencyScanner.Instance.GetReachableRelatedTypes(resourceSchemaType.ResourceType)) + { + Type resourceDataConstructedType = typeof(DataInResponse<>).MakeGenericType(relatedType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(resourceDataConstructedType, false, schemaRepository); + } + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs new file mode 100644 index 0000000000..4d7783f780 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs @@ -0,0 +1,641 @@ +using System.Collections.Concurrent; +using System.Reflection; +using System.Runtime.CompilerServices; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class DataSchemaGenerator +{ + // Workaround for bug at https://github.com/microsoft/kiota/issues/2432#issuecomment-2436625836. + private static readonly bool RepeatDiscriminatorInResponseDerivedTypes = bool.Parse(bool.TrueString); + + private static readonly ConcurrentDictionary UltimateBaseResourceTypeCache = []; + + private static readonly string[] DataPropertyNamesInOrder = + [ + JsonApiPropertyName.Type, + JsonApiPropertyName.Id, + JsonApiPropertyName.Lid, + JsonApiPropertyName.Attributes, + JsonApiPropertyName.Relationships, + JsonApiPropertyName.Links, + JsonApiPropertyName.Meta + ]; + + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly GenerationCacheSchemaGenerator _generationCacheSchemaGenerator; + private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; + private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + private readonly IJsonApiOptions _options; + private readonly IResourceGraph _resourceGraph; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + private readonly RelationshipTypeFactory _relationshipTypeFactory; + private readonly ResourceDocumentationReader _resourceDocumentationReader; + + public DataSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + GenerationCacheSchemaGenerator generationCacheSchemaGenerator, ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, + ResourceIdSchemaGenerator resourceIdSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + MetaSchemaGenerator metaSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector, IJsonApiOptions options, IResourceGraph resourceGraph, + ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, + ResourceDocumentationReader resourceDocumentationReader) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(generationCacheSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceTypeSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); + ArgumentNullException.ThrowIfNull(linksVisibilitySchemaGenerator); + ArgumentNullException.ThrowIfNull(metaSchemaGenerator); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(resourceGraph); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + ArgumentNullException.ThrowIfNull(relationshipTypeFactory); + ArgumentNullException.ThrowIfNull(resourceDocumentationReader); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultSchemaGenerator = defaultSchemaGenerator; + _generationCacheSchemaGenerator = generationCacheSchemaGenerator; + _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; + _resourceIdSchemaGenerator = resourceIdSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; + _metaSchemaGenerator = metaSchemaGenerator; + _schemaIdSelector = schemaIdSelector; + _options = options; + _resourceGraph = resourceGraph; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + _relationshipTypeFactory = relationshipTypeFactory; + _resourceDocumentationReader = resourceDocumentationReader; + } + + public OpenApiSchema GenerateSchema(Type dataSchemaType, bool forRequestSchema, SchemaRepository schemaRepository) + { + // For a given resource (identifier) type, we always generate the full type hierarchy. Discriminator mappings + // are managed manually, because there's no way to intercept in the Swashbuckle recursive component schema generation. + + ArgumentNullException.ThrowIfNull(dataSchemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(dataSchemaType, out OpenApiSchema referenceSchemaForData)) + { + return referenceSchemaForData; + } + + var resourceSchemaType = ResourceSchemaType.Create(dataSchemaType, _resourceGraph); + ResourceType resourceType = resourceSchemaType.ResourceType; + + Type? commonDataSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType); + + if (commonDataSchemaType != null) + { + _ = GenerateSchemaForCommonData(commonDataSchemaType, schemaRepository); + } + + if (resourceType.BaseType != null) + { + ResourceType ultimateBaseResourceType = GetUltimateBaseType(resourceType); + Type ultimateBaseSchemaType = ChangeResourceTypeInSchemaType(dataSchemaType, ultimateBaseResourceType); + + _ = GenerateSchema(ultimateBaseSchemaType, forRequestSchema, schemaRepository); + + return schemaRepository.LookupByType(dataSchemaType); + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, dataSchemaType); + + referenceSchemaForData = _defaultSchemaGenerator.GenerateSchema(dataSchemaType, schemaRepository); + OpenApiSchema fullSchemaForData = schemaRepository.Schemas[referenceSchemaForData.Reference.Id]; + fullSchemaForData.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForData = fullSchemaForData.UnwrapLastExtendedSchema(); + + SetAbstract(inlineSchemaForData, resourceSchemaType); + SetResourceType(inlineSchemaForData, resourceType, schemaRepository); + AdaptResourceIdentity(inlineSchemaForData, resourceSchemaType, forRequestSchema, schemaRepository); + SetResourceId(inlineSchemaForData, resourceType, schemaRepository); + SetResourceFields(inlineSchemaForData, resourceSchemaType, forRequestSchema, schemaRepository); + SetDocumentation(fullSchemaForData, resourceType); + SetLinksVisibility(inlineSchemaForData, resourceSchemaType, schemaRepository); + + if (resourceType.IsPartOfTypeHierarchy()) + { + GenerateDataSchemasForDirectlyDerivedTypes(resourceSchemaType, forRequestSchema, schemaRepository); + } + + inlineSchemaForData.ReorderProperties(DataPropertyNamesInOrder); + + if (commonDataSchemaType != null) + { + MapInDiscriminator(resourceSchemaType, forRequestSchema, JsonApiPropertyName.Type, schemaRepository); + } + + if (RequiresRootObjectTypeInDataSchema(resourceSchemaType, forRequestSchema)) + { + fullSchemaForData.Extensions[SetSchemaTypeToObjectDocumentFilter.RequiresRootObjectTypeKey] = new OpenApiBoolean(true); + } + + traceScope.TraceSucceeded(referenceSchemaForData.Reference.Id); + return referenceSchemaForData; + } + + private static Type? GetCommonSchemaType(Type schemaOpenType) + { + StrongBox? boxedSchemaType = null; + + if (schemaOpenType == typeof(IdentifierInRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(IdentifierInRequest)); + } + else if (schemaOpenType == typeof(DataInCreateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(ResourceInCreateRequest)); + } + else if (schemaOpenType == typeof(AttributesInCreateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(AttributesInCreateRequest)); + } + else if (schemaOpenType == typeof(RelationshipsInCreateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(RelationshipsInCreateRequest)); + } + else if (schemaOpenType == typeof(DataInUpdateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(ResourceInUpdateRequest)); + } + else if (schemaOpenType == typeof(AttributesInUpdateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(AttributesInUpdateRequest)); + } + else if (schemaOpenType == typeof(RelationshipsInUpdateRequest<>)) + { + boxedSchemaType = new StrongBox(typeof(RelationshipsInUpdateRequest)); + } + else if (schemaOpenType == typeof(IdentifierInResponse<>)) + { + boxedSchemaType = new StrongBox(null); + } + else if (schemaOpenType == typeof(DataInResponse<>)) + { + boxedSchemaType = new StrongBox(typeof(ResourceInResponse)); + } + else if (schemaOpenType == typeof(AttributesInResponse<>)) + { + boxedSchemaType = new StrongBox(typeof(AttributesInResponse)); + } + else if (schemaOpenType == typeof(RelationshipsInResponse<>)) + { + boxedSchemaType = new StrongBox(typeof(RelationshipsInResponse)); + } + + ConsistencyGuard.ThrowIf(boxedSchemaType == null); + return boxedSchemaType.Value; + } + + public OpenApiSchema GenerateSchemaForCommonData(Type commonDataSchemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(commonDataSchemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(commonDataSchemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, commonDataSchemaType); + + OpenApiSchema referenceSchemaForResourceType = _resourceTypeSchemaGenerator.GenerateSchema(schemaRepository); + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([JsonApiPropertyName.Type]), + Properties = new Dictionary + { + [JsonApiPropertyName.Type] = referenceSchemaForResourceType.WrapInExtendedSchema(), + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = JsonApiPropertyName.Type, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(commonDataSchemaType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(commonDataSchemaType, schemaId); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } + + private static ResourceType GetUltimateBaseType(ResourceType resourceType) + { + return UltimateBaseResourceTypeCache.GetOrAdd(resourceType, type => + { + ResourceType baseType = type; + + while (baseType.BaseType != null) + { + baseType = baseType.BaseType; + } + + return baseType; + }); + } + + private static Type ChangeResourceTypeInSchemaType(Type schemaType, ResourceType resourceType) + { + Type schemaOpenType = schemaType.ConstructedToOpenType(); + return schemaOpenType.MakeGenericType(resourceType.ClrType); + } + + private static void SetAbstract(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType) + { + if (resourceSchemaType.ResourceType.ClrType.IsAbstract && resourceSchemaType.SchemaOpenType != typeof(IdentifierInRequest<>)) + { + fullSchema.Extensions["x-abstract"] = new OpenApiBoolean(true); + } + } + + private void SetResourceType(OpenApiSchema fullSchema, ResourceType resourceType, SchemaRepository schemaRepository) + { + if (fullSchema.Properties.ContainsKey(JsonApiPropertyName.Type)) + { + OpenApiSchema referenceSchema = _resourceTypeSchemaGenerator.GenerateSchema(resourceType, schemaRepository); + fullSchema.Properties[JsonApiPropertyName.Type] = referenceSchema.WrapInExtendedSchema(); + } + } + + private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType, bool forRequestSchema, + SchemaRepository schemaRepository) + { + if (!forRequestSchema) + { + return; + } + + bool hasAtomicOperationsEndpoint = _generationCacheSchemaGenerator.HasAtomicOperationsEndpoint(schemaRepository); + + if (!hasAtomicOperationsEndpoint) + { + fullSchema.Properties.Remove(JsonApiPropertyName.Lid); + } + + if (resourceSchemaType.SchemaOpenType == typeof(DataInCreateRequest<>)) + { + ClientIdGenerationMode clientIdGeneration = resourceSchemaType.ResourceType.ClientIdGeneration ?? _options.ClientIdGeneration; + + if (hasAtomicOperationsEndpoint) + { + if (clientIdGeneration == ClientIdGenerationMode.Forbidden) + { + fullSchema.Properties.Remove(JsonApiPropertyName.Id); + } + else if (clientIdGeneration == ClientIdGenerationMode.Required) + { + fullSchema.Properties.Remove(JsonApiPropertyName.Lid); + fullSchema.Required.Add(JsonApiPropertyName.Id); + } + } + else + { + if (clientIdGeneration == ClientIdGenerationMode.Forbidden) + { + fullSchema.Properties.Remove(JsonApiPropertyName.Id); + } + else if (clientIdGeneration == ClientIdGenerationMode.Required) + { + fullSchema.Required.Add(JsonApiPropertyName.Id); + } + } + } + else + { + if (!hasAtomicOperationsEndpoint) + { + fullSchema.Required.Add(JsonApiPropertyName.Id); + } + } + } + + private void SetResourceId(OpenApiSchema fullSchema, ResourceType resourceType, SchemaRepository schemaRepository) + { + if (fullSchema.Properties.ContainsKey(JsonApiPropertyName.Id)) + { + OpenApiSchema idSchema = _resourceIdSchemaGenerator.GenerateSchema(resourceType, schemaRepository); + fullSchema.Properties[JsonApiPropertyName.Id] = idSchema; + } + } + + private void SetResourceFields(OpenApiSchema fullSchemaForData, ResourceSchemaType resourceSchemaType, bool forRequestSchema, + SchemaRepository schemaRepository) + { + bool schemaHasFields = fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Attributes) && + fullSchemaForData.Properties.ContainsKey(JsonApiPropertyName.Relationships); + + if (schemaHasFields) + { + var fieldSchemaBuilder = new ResourceFieldSchemaBuilder(_schemaGenerationTracer, _defaultSchemaGenerator, this, _linksVisibilitySchemaGenerator, + _resourceFieldValidationMetadataProvider, _relationshipTypeFactory, resourceSchemaType); + + SetFieldSchemaMembers(fullSchemaForData, resourceSchemaType, forRequestSchema, true, fieldSchemaBuilder, schemaRepository); + SetFieldSchemaMembers(fullSchemaForData, resourceSchemaType, forRequestSchema, false, fieldSchemaBuilder, schemaRepository); + } + } + + private void SetFieldSchemaMembers(OpenApiSchema fullSchemaForData, ResourceSchemaType resourceSchemaTypeForData, bool forRequestSchema, bool forAttributes, + ResourceFieldSchemaBuilder fieldSchemaBuilder, SchemaRepository schemaRepository) + { + string propertyNameInSchema = forAttributes ? JsonApiPropertyName.Attributes : JsonApiPropertyName.Relationships; + + OpenApiSchema referenceSchemaForFields = fullSchemaForData.Properties[propertyNameInSchema].UnwrapLastExtendedSchema(); + OpenApiSchema fullSchemaForFields = schemaRepository.Schemas[referenceSchemaForFields.Reference.Id]; + fullSchemaForFields.AdditionalPropertiesAllowed = false; + + SetAbstract(fullSchemaForFields, resourceSchemaTypeForData); + + if (forAttributes) + { + fieldSchemaBuilder.SetMembersOfAttributes(fullSchemaForFields, forRequestSchema, schemaRepository); + } + else + { + fieldSchemaBuilder.SetMembersOfRelationships(fullSchemaForFields, forRequestSchema, schemaRepository); + } + + if (fullSchemaForFields.Properties.Count == 0 && !resourceSchemaTypeForData.ResourceType.IsPartOfTypeHierarchy()) + { + fullSchemaForData.Properties.Remove(propertyNameInSchema); + schemaRepository.Schemas.Remove(referenceSchemaForFields.Reference.Id); + } + else + { + ResourceSchemaType resourceSchemaTypeForFields = + GetResourceSchemaTypeForFieldsProperty(resourceSchemaTypeForData, forAttributes ? "Attributes" : "Relationships"); + + Type? commonFieldsSchemaType = GetCommonSchemaType(resourceSchemaTypeForFields.SchemaOpenType); + ConsistencyGuard.ThrowIf(commonFieldsSchemaType == null); + + _ = GenerateSchemaForCommonFields(commonFieldsSchemaType, schemaRepository); + + MapInDiscriminator(resourceSchemaTypeForFields, forRequestSchema, OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + schemaRepository); + + Type baseSchemaType; + + if (resourceSchemaTypeForFields.ResourceType.BaseType != null) + { + ResourceSchemaType resourceSchemaTypeForBase = + resourceSchemaTypeForFields.ChangeResourceType(resourceSchemaTypeForFields.ResourceType.BaseType); + + baseSchemaType = resourceSchemaTypeForBase.SchemaConstructedType; + } + else + { + baseSchemaType = commonFieldsSchemaType; + } + + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(baseSchemaType); + + schemaRepository.Schemas[referenceSchemaForFields.Reference.Id] = new OpenApiSchema + { + AllOf = + [ + referenceSchemaForBase, + fullSchemaForFields + ], + AdditionalPropertiesAllowed = false + }; + } + } + + private ResourceSchemaType GetResourceSchemaTypeForFieldsProperty(ResourceSchemaType resourceSchemaTypeForData, string propertyName) + { + PropertyInfo? fieldsProperty = resourceSchemaTypeForData.SchemaConstructedType.GetProperty(propertyName); + ConsistencyGuard.ThrowIf(fieldsProperty == null); + + Type fieldsConstructedType = fieldsProperty.PropertyType; + return ResourceSchemaType.Create(fieldsConstructedType, _resourceGraph); + } + + private OpenApiSchema GenerateSchemaForCommonFields(Type commonFieldsSchemaType, SchemaRepository schemaRepository) + { + if (schemaRepository.TryLookupByType(commonFieldsSchemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, commonFieldsSchemaType); + + OpenApiSchema referenceSchemaForResourceType = _resourceTypeSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName]), + Properties = new Dictionary + { + [OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName] = referenceSchemaForResourceType.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(commonFieldsSchemaType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(commonFieldsSchemaType, schemaId); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } + + private void MapInDiscriminator(ResourceSchemaType resourceSchemaType, bool forRequestSchema, string discriminatorPropertyName, + SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForDerived = schemaRepository.LookupByType(resourceSchemaType.SchemaConstructedType); + + foreach (ResourceType? baseResourceType in GetBaseTypesToMapInto(resourceSchemaType, forRequestSchema)) + { + Type baseSchemaType = baseResourceType == null + ? GetCommonSchemaType(resourceSchemaType.SchemaOpenType)! + : resourceSchemaType.ChangeResourceType(baseResourceType).SchemaConstructedType; + + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(baseSchemaType); + OpenApiSchema inlineSchemaForBase = schemaRepository.Schemas[referenceSchemaForBase.Reference.Id].UnwrapLastExtendedSchema(); + + inlineSchemaForBase.Discriminator ??= new OpenApiDiscriminator + { + PropertyName = discriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }; + + if (RepeatDiscriminatorInResponseDerivedTypes && !forRequestSchema) + { + inlineSchemaForBase.Required.Add(discriminatorPropertyName); + } + + string publicName = resourceSchemaType.ResourceType.PublicName; + + if (inlineSchemaForBase.Discriminator.Mapping.TryAdd(publicName, referenceSchemaForDerived.Reference.ReferenceV3) && baseResourceType == null) + { + MapResourceTypeInEnum(publicName, schemaRepository); + } + } + } + + private static IEnumerable GetBaseTypesToMapInto(ResourceSchemaType resourceSchemaType, bool forRequestSchema) + { + bool dependsOnCommonSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType) != null; + + if (RepeatDiscriminatorInResponseDerivedTypes && !forRequestSchema) + { + ResourceType? baseType = resourceSchemaType.ResourceType.BaseType; + + while (baseType != null) + { + yield return baseType; + + baseType = baseType.BaseType; + } + } + else + { + if (!dependsOnCommonSchemaType) + { + yield return GetUltimateBaseType(resourceSchemaType.ResourceType); + } + } + + if (dependsOnCommonSchemaType) + { + yield return null; + } + } + + private void MapResourceTypeInEnum(string publicName, SchemaRepository schemaRepository) + { + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + OpenApiSchema fullSchema = schemaRepository.Schemas[schemaId]; + + if (!fullSchema.Enum.Any(openApiAny => openApiAny is OpenApiString openApiString && openApiString.Value == publicName)) + { + fullSchema.Enum.Add(new OpenApiString(publicName)); + } + } + + private void SetDocumentation(OpenApiSchema fullSchema, ResourceType resourceType) + { + fullSchema.Description = _resourceDocumentationReader.GetDocumentationForType(resourceType); + } + + private void SetLinksVisibility(OpenApiSchema fullSchema, ResourceSchemaType resourceSchemaType, SchemaRepository schemaRepository) + { + _linksVisibilitySchemaGenerator.UpdateSchemaForResource(resourceSchemaType, fullSchema, schemaRepository); + } + + private void GenerateDataSchemasForDirectlyDerivedTypes(ResourceSchemaType resourceSchemaType, bool forRequestSchema, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForBase = schemaRepository.LookupByType(resourceSchemaType.SchemaConstructedType); + + foreach (ResourceType derivedType in resourceSchemaType.ResourceType.DirectlyDerivedTypes) + { + ResourceSchemaType resourceSchemaTypeForDerived = resourceSchemaType.ChangeResourceType(derivedType); + Type derivedSchemaType = resourceSchemaTypeForDerived.SchemaConstructedType; + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, resourceSchemaTypeForDerived.SchemaConstructedType); + + OpenApiSchema referenceSchemaForDerived = _defaultSchemaGenerator.GenerateSchema(derivedSchemaType, schemaRepository); + OpenApiSchema fullSchemaForDerived = schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id]; + fullSchemaForDerived.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForDerived = fullSchemaForDerived.UnwrapLastExtendedSchema(); + SetResourceFields(inlineSchemaForDerived, resourceSchemaTypeForDerived, forRequestSchema, schemaRepository); + + SetAbstract(inlineSchemaForDerived, resourceSchemaTypeForDerived); + RemoveProperties(inlineSchemaForDerived); + MapInDiscriminator(resourceSchemaTypeForDerived, forRequestSchema, JsonApiPropertyName.Type, schemaRepository); + + if (fullSchemaForDerived.AllOf.Count == 0) + { + var compositeSchemaForDerived = new OpenApiSchema + { + AllOf = + [ + referenceSchemaForBase, + fullSchemaForDerived + ], + AdditionalPropertiesAllowed = false + }; + + schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id] = compositeSchemaForDerived; + } + else + { + fullSchemaForDerived.AllOf[0] = referenceSchemaForBase; + } + + if (RequiresRootObjectTypeInDataSchema(resourceSchemaTypeForDerived, forRequestSchema)) + { + OpenApiSchema fullSchemaForData = schemaRepository.Schemas[referenceSchemaForDerived.Reference.Id]; + fullSchemaForData.Extensions[SetSchemaTypeToObjectDocumentFilter.RequiresRootObjectTypeKey] = new OpenApiBoolean(true); + } + + GenerateDataSchemasForDirectlyDerivedTypes(resourceSchemaTypeForDerived, forRequestSchema, schemaRepository); + + traceScope.TraceSucceeded(referenceSchemaForDerived.Reference.Id); + } + } + + private static void RemoveProperties(OpenApiSchema fullSchema) + { + foreach (string propertyName in fullSchema.Properties.Keys) + { + fullSchema.Properties.Remove(propertyName); + fullSchema.Required.Remove(propertyName); + } + } + + private static bool RequiresRootObjectTypeInDataSchema(ResourceSchemaType resourceSchemaType, bool forRequestSchema) + { + Type? commonDataSchemaType = GetCommonSchemaType(resourceSchemaType.SchemaOpenType); + + if (forRequestSchema && (commonDataSchemaType == typeof(IdentifierInRequest) || + (!resourceSchemaType.ResourceType.ClrType.IsAbstract && commonDataSchemaType is { IsGenericType: false }))) + { + // Bug workaround for NSwag, which fails to properly infer implicit { "type": "object" } of outer schema when it appears inside an allOf. + // As a result, the required Data property in the generated client is assigned "default!" instead of a new instance. + // But there's another bug on top of that: When the declared type of Data is abstract, it still generates assignment with a new instance, which fails to compile. + return true; + } + + return false; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs new file mode 100644 index 0000000000..5c099a3fc1 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/LinksVisibilitySchemaGenerator.cs @@ -0,0 +1,208 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +/// +/// Hides links that are never returned. +/// +/// +/// Tradeoff: Special-casing links per resource type and per relationship means an explosion of expanded types, only because the links visibility may +/// vary. Furthermore, relationship links fallback to their left-type resource, whereas we generate right-type component schemas for relationships. To +/// keep it simple, we take the union of exposed links on resource types and relationships. Only what's not in this unification gets hidden. For example, +/// when options == None, typeof(Blogs) == Self, and typeof(Posts) == Related, we'll keep Self | Related for both Blogs and Posts, and remove any other +/// links. +/// +internal sealed class LinksVisibilitySchemaGenerator +{ + private const LinkTypes ResourceTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy; + private const LinkTypes ResourceCollectionTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy | LinkTypes.Pagination; + private const LinkTypes ResourceIdentifierTopLinkTypes = LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy; + private const LinkTypes ResourceIdentifierCollectionTopLinkTypes = LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy | LinkTypes.Pagination; + private const LinkTypes ErrorTopLinkTypes = LinkTypes.Self | LinkTypes.DescribedBy; + private const LinkTypes RelationshipLinkTypes = LinkTypes.Self | LinkTypes.Related; + private const LinkTypes ResourceLinkTypes = LinkTypes.Self; + + private static readonly Dictionary LinksInJsonApiSchemaTypes = new() + { + [typeof(NullableSecondaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(PrimaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(SecondaryResponseDocument<>)] = ResourceTopLinkTypes, + [typeof(CollectionResponseDocument<>)] = ResourceCollectionTopLinkTypes, + [typeof(IdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(NullableIdentifierResponseDocument<>)] = ResourceIdentifierTopLinkTypes, + [typeof(IdentifierCollectionResponseDocument<>)] = ResourceIdentifierCollectionTopLinkTypes, + [typeof(ErrorResponseDocument)] = ErrorTopLinkTypes, + [typeof(OperationsResponseDocument)] = ResourceTopLinkTypes, + [typeof(NullableToOneInResponse<>)] = RelationshipLinkTypes, + [typeof(ToManyInResponse<>)] = RelationshipLinkTypes, + [typeof(ToOneInResponse<>)] = RelationshipLinkTypes, + [typeof(DataInResponse<>)] = ResourceLinkTypes + }; + + private static readonly Dictionary> LinkTypeToPropertyNamesMap = new() + { + [LinkTypes.Self] = ["self"], + [LinkTypes.Related] = ["related"], + [LinkTypes.DescribedBy] = ["describedby"], + [LinkTypes.Pagination] = + [ + "first", + "last", + "prev", + "next" + ] + }; + + private readonly Lazy _lazyLinksVisibility; + + public LinksVisibilitySchemaGenerator(IJsonApiOptions options, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _lazyLinksVisibility = new Lazy(() => new LinksVisibility(options, resourceGraph), LazyThreadSafetyMode.ExecutionAndPublication); + } + + public void UpdateSchemaForTopLevel(Type schemaType, OpenApiSchema fullSchemaForLinksContainer, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(fullSchemaForLinksContainer); + + Type lookupType = schemaType.ConstructedToOpenType(); + + if (LinksInJsonApiSchemaTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForLinksContainer, _lazyLinksVisibility.Value.TopLevelLinks, possibleLinkTypes, schemaRepository); + } + } + + public void UpdateSchemaForResource(ResourceSchemaType resourceSchemaType, OpenApiSchema fullSchemaForResourceData, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(resourceSchemaType); + ArgumentNullException.ThrowIfNull(fullSchemaForResourceData); + + if (LinksInJsonApiSchemaTypes.TryGetValue(resourceSchemaType.SchemaOpenType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForResourceData, _lazyLinksVisibility.Value.ResourceLinks, possibleLinkTypes, schemaRepository); + } + } + + public void UpdateSchemaForRelationship(Type schemaType, OpenApiSchema fullSchemaForRelationship, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(fullSchemaForRelationship); + + Type lookupType = schemaType.ConstructedToOpenType(); + + if (LinksInJsonApiSchemaTypes.TryGetValue(lookupType, out LinkTypes possibleLinkTypes)) + { + UpdateLinksProperty(fullSchemaForRelationship, _lazyLinksVisibility.Value.RelationshipLinks, possibleLinkTypes, schemaRepository); + } + } + + private void UpdateLinksProperty(OpenApiSchema fullSchemaForLinksContainer, LinkTypes visibleLinkTypes, LinkTypes possibleLinkTypes, + SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForLinks = fullSchemaForLinksContainer.Properties[JsonApiPropertyName.Links].UnwrapLastExtendedSchema(); + + if ((visibleLinkTypes & possibleLinkTypes) == 0) + { + fullSchemaForLinksContainer.Required.Remove(JsonApiPropertyName.Links); + fullSchemaForLinksContainer.Properties.Remove(JsonApiPropertyName.Links); + + schemaRepository.Schemas.Remove(referenceSchemaForLinks.Reference.Id); + } + else if (visibleLinkTypes != possibleLinkTypes) + { + string linksSchemaId = referenceSchemaForLinks.Reference.Id; + + if (schemaRepository.Schemas.TryGetValue(linksSchemaId, out OpenApiSchema? fullSchemaForLinks)) + { + UpdateLinkProperties(fullSchemaForLinks, visibleLinkTypes); + } + } + } + + private void UpdateLinkProperties(OpenApiSchema fullSchemaForLinks, LinkTypes availableLinkTypes) + { + foreach (string propertyName in LinkTypeToPropertyNamesMap.Where(pair => !availableLinkTypes.HasFlag(pair.Key)).SelectMany(pair => pair.Value)) + { + fullSchemaForLinks.Required.Remove(propertyName); + fullSchemaForLinks.Properties.Remove(propertyName); + } + } + + private sealed class LinksVisibility + { + public LinkTypes TopLevelLinks { get; } + public LinkTypes ResourceLinks { get; } + public LinkTypes RelationshipLinks { get; } + + public LinksVisibility(IJsonApiOptions options, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(resourceGraph); + + var unionTopLevelLinks = LinkTypes.None; + var unionResourceLinks = LinkTypes.None; + var unionRelationshipLinks = LinkTypes.None; + + foreach (ResourceType resourceType in resourceGraph.GetResourceTypes()) + { + LinkTypes topLevelLinks = GetTopLevelLinks(resourceType, options); + unionTopLevelLinks |= topLevelLinks; + + LinkTypes resourceLinks = GetResourceLinks(resourceType, options); + unionResourceLinks |= resourceLinks; + + LinkTypes relationshipLinks = GetRelationshipLinks(resourceType, options); + unionRelationshipLinks |= relationshipLinks; + } + + TopLevelLinks = Normalize(unionTopLevelLinks); + ResourceLinks = Normalize(unionResourceLinks); + RelationshipLinks = Normalize(unionRelationshipLinks); + } + + private LinkTypes GetTopLevelLinks(ResourceType resourceType, IJsonApiOptions options) + { + return resourceType.TopLevelLinks != LinkTypes.NotConfigured ? resourceType.TopLevelLinks : + options.TopLevelLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.TopLevelLinks; + } + + private LinkTypes GetResourceLinks(ResourceType resourceType, IJsonApiOptions options) + { + return resourceType.ResourceLinks != LinkTypes.NotConfigured ? resourceType.ResourceLinks : + options.ResourceLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.ResourceLinks; + } + + private LinkTypes GetRelationshipLinks(ResourceType resourceType, IJsonApiOptions options) + { + LinkTypes unionRelationshipLinks = resourceType.RelationshipLinks != LinkTypes.NotConfigured ? resourceType.RelationshipLinks : + options.RelationshipLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.RelationshipLinks; + + foreach (RelationshipAttribute relationship in resourceType.Relationships) + { + LinkTypes relationshipLinks = relationship.Links != LinkTypes.NotConfigured ? relationship.Links : + relationship.LeftType.RelationshipLinks != LinkTypes.NotConfigured ? relationship.LeftType.RelationshipLinks : + options.RelationshipLinks == LinkTypes.NotConfigured ? LinkTypes.None : options.RelationshipLinks; + + unionRelationshipLinks |= relationshipLinks; + } + + return unionRelationshipLinks; + } + + private static LinkTypes Normalize(LinkTypes linkTypes) + { + return linkTypes != LinkTypes.None ? linkTypes & ~LinkTypes.None : linkTypes; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/MetaSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/MetaSchemaGenerator.cs new file mode 100644 index 0000000000..1e1bd07852 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/MetaSchemaGenerator.cs @@ -0,0 +1,50 @@ +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class MetaSchemaGenerator +{ + private static readonly Type SchemaType = typeof(Meta); + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + + public MetaSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, JsonApiSchemaIdSelector schemaIdSelector) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + + _schemaGenerationTracer = schemaGenerationTracer; + _schemaIdSelector = schemaIdSelector; + } + + public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(SchemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, SchemaType); + + var fullSchema = new OpenApiSchema + { + Type = "object", + AdditionalProperties = new OpenApiSchema + { + Nullable = true + } + }; + + string schemaId = _schemaIdSelector.GetMetaSchemaId(); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(SchemaType, schemaId); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs new file mode 100644 index 0000000000..98f176e8df --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipIdentifierSchemaGenerator.cs @@ -0,0 +1,94 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class RelationshipIdentifierSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly ResourceTypeSchemaGenerator _resourceTypeSchemaGenerator; + private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; + private readonly RelationshipNameSchemaGenerator _relationshipNameSchemaGenerator; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + + public RelationshipIdentifierSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + ResourceTypeSchemaGenerator resourceTypeSchemaGenerator, ResourceIdSchemaGenerator resourceIdSchemaGenerator, + RelationshipNameSchemaGenerator relationshipNameSchemaGenerator, JsonApiSchemaIdSelector schemaIdSelector) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceTypeSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); + ArgumentNullException.ThrowIfNull(relationshipNameSchemaGenerator); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultSchemaGenerator = defaultSchemaGenerator; + _resourceTypeSchemaGenerator = resourceTypeSchemaGenerator; + _resourceIdSchemaGenerator = resourceIdSchemaGenerator; + _relationshipNameSchemaGenerator = relationshipNameSchemaGenerator; + _schemaIdSelector = schemaIdSelector; + } + + public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(relationship); + ArgumentNullException.ThrowIfNull(schemaRepository); + + string schemaId = _schemaIdSelector.GetRelationshipIdentifierSchemaId(relationship); + + if (schemaRepository.Schemas.ContainsKey(schemaId)) + { + return new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = schemaId, + Type = ReferenceType.Schema + } + }; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, relationship); + + Type relationshipIdentifierConstructedType = typeof(RelationshipIdentifier<>).MakeGenericType(relationship.LeftType.ClrType); + ConsistencyGuard.ThrowIf(schemaRepository.TryLookupByType(relationshipIdentifierConstructedType, out _)); + + OpenApiSchema referenceSchemaForIdentifier = _defaultSchemaGenerator.GenerateSchema(relationshipIdentifierConstructedType, schemaRepository); + OpenApiSchema fullSchemaForIdentifier = schemaRepository.Schemas[referenceSchemaForIdentifier.Reference.Id]; + + fullSchemaForIdentifier.Properties.Remove(JsonApiPropertyName.Meta); + + SetResourceType(fullSchemaForIdentifier, relationship.LeftType, schemaRepository); + SetResourceId(fullSchemaForIdentifier, relationship.LeftType, schemaRepository); + SetRelationship(fullSchemaForIdentifier, relationship, schemaRepository); + + schemaRepository.ReplaceSchemaId(relationshipIdentifierConstructedType, schemaId); + referenceSchemaForIdentifier.Reference.Id = schemaId; + + traceScope.TraceSucceeded(schemaId); + return referenceSchemaForIdentifier; + } + + private void SetResourceType(OpenApiSchema fullSchemaForIdentifier, ResourceType resourceType, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchema = _resourceTypeSchemaGenerator.GenerateSchema(resourceType, schemaRepository); + fullSchemaForIdentifier.Properties[JsonApiPropertyName.Type] = referenceSchema.WrapInExtendedSchema(); + } + + private void SetResourceId(OpenApiSchema fullSchemaForResourceData, ResourceType resourceType, SchemaRepository schemaRepository) + { + OpenApiSchema idSchema = _resourceIdSchemaGenerator.GenerateSchema(resourceType, schemaRepository); + fullSchemaForResourceData.Properties[JsonApiPropertyName.Id] = idSchema; + } + + private void SetRelationship(OpenApiSchema fullSchemaForIdentifier, RelationshipAttribute relationship, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchema = _relationshipNameSchemaGenerator.GenerateSchema(relationship, schemaRepository); + fullSchemaForIdentifier.Properties[JsonApiPropertyName.Relationship] = referenceSchema.WrapInExtendedSchema(); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs new file mode 100644 index 0000000000..7f5c0c5d3a --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/RelationshipNameSchemaGenerator.cs @@ -0,0 +1,54 @@ +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class RelationshipNameSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + + public RelationshipNameSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, JsonApiSchemaIdSelector schemaIdSelector) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + + _schemaGenerationTracer = schemaGenerationTracer; + _schemaIdSelector = schemaIdSelector; + } + + public OpenApiSchema GenerateSchema(RelationshipAttribute relationship, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(relationship); + ArgumentNullException.ThrowIfNull(schemaRepository); + + string schemaId = _schemaIdSelector.GetRelationshipNameSchemaId(relationship); + + if (schemaRepository.Schemas.ContainsKey(schemaId)) + { + return new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = schemaId, + Type = ReferenceType.Schema + } + }; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, relationship); + + var fullSchema = new OpenApiSchema + { + Type = "string", + Enum = [new OpenApiString(relationship.PublicName)] + }; + + OpenApiSchema referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdSchemaGenerator.cs new file mode 100644 index 0000000000..21bc5020ed --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceIdSchemaGenerator.cs @@ -0,0 +1,45 @@ +using JsonApiDotNetCore.Configuration; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class ResourceIdSchemaGenerator +{ + private readonly SchemaGenerator _defaultSchemaGenerator; + + public ResourceIdSchemaGenerator(SchemaGenerator defaultSchemaGenerator) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + + _defaultSchemaGenerator = defaultSchemaGenerator; + } + + public OpenApiSchema GenerateSchema(ResourceType resourceType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(resourceType); + + return GenerateSchema(resourceType.IdentityClrType, schemaRepository); + } + + public OpenApiSchema GenerateSchema(Type resourceIdClrType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(resourceIdClrType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + OpenApiSchema idSchema = _defaultSchemaGenerator.GenerateSchema(resourceIdClrType, schemaRepository); + ConsistencyGuard.ThrowIf(idSchema.Reference != null); + + idSchema.Type = "string"; + + if (resourceIdClrType != typeof(string)) + { + // When using string IDs, it's discouraged (but possible) to use an empty string as primary key value, because + // some things won't work: get-by-id, update and delete resource are impossible, and rendered links are unusable. + // For other ID types, provide the length constraint as a fallback in case the type hint isn't recognized. + idSchema.MinLength = 1; + } + + return idSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs new file mode 100644 index 0000000000..eb933bedbe --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/ResourceTypeSchemaGenerator.cs @@ -0,0 +1,91 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; + +internal sealed class ResourceTypeSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + + public ResourceTypeSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, JsonApiSchemaIdSelector schemaIdSelector) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + + _schemaGenerationTracer = schemaGenerationTracer; + _schemaIdSelector = schemaIdSelector; + } + + public OpenApiSchema GenerateSchema(ResourceType resourceType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(resourceType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(resourceType.ClrType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, resourceType.ClrType); + + var fullSchema = new OpenApiSchema + { + Type = "string", + Enum = resourceType.ClrType.IsAbstract ? [] : [new OpenApiString(resourceType.PublicName)], + Extensions = + { + [StringEnumOrderingFilter.RequiresSortKey] = new OpenApiBoolean(true) + } + }; + + foreach (ResourceType derivedType in resourceType.GetAllConcreteDerivedTypes()) + { + fullSchema.Enum.Add(new OpenApiString(derivedType.PublicName)); + } + + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(resourceType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(resourceType.ClrType, schemaId); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } + + public OpenApiSchema GenerateSchema(SchemaRepository schemaRepository) + { + string schemaId = _schemaIdSelector.GetResourceTypeSchemaId(null); + + if (schemaRepository.Schemas.ContainsKey(schemaId)) + { + return new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = schemaId, + Type = ReferenceType.Schema + } + }; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this); + + var fullSchema = new OpenApiSchema + { + Type = "string", + Extensions = + { + [StringEnumOrderingFilter.RequiresSortKey] = new OpenApiBoolean(true) + } + }; + + OpenApiSchema referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs new file mode 100644 index 0000000000..f128f89299 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/AtomicOperationsDocumentSchemaGenerator.cs @@ -0,0 +1,485 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Serialization.Objects; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for an atomic:operations request/response document. +/// +internal sealed class AtomicOperationsDocumentSchemaGenerator : DocumentSchemaGenerator +{ + private static readonly Type AtomicOperationAbstractType = typeof(AtomicOperation); + + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly AtomicOperationCodeSchemaGenerator _atomicOperationCodeSchemaGenerator; + private readonly DataSchemaGenerator _dataSchemaGenerator; + private readonly RelationshipIdentifierSchemaGenerator _relationshipIdentifierSchemaGenerator; + private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + private readonly IAtomicOperationFilter _atomicOperationFilter; + private readonly JsonApiSchemaIdSelector _schemaIdSelector; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + private readonly IResourceGraph _resourceGraph; + + public AtomicOperationsDocumentSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + AtomicOperationCodeSchemaGenerator atomicOperationCodeSchemaGenerator, DataSchemaGenerator dataSchemaGenerator, + RelationshipIdentifierSchemaGenerator relationshipIdentifierSchemaGenerator, DataContainerSchemaGenerator dataContainerSchemaGenerator, + MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IAtomicOperationFilter atomicOperationFilter, + JsonApiSchemaIdSelector schemaIdSelector, ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, IJsonApiOptions options, + IResourceGraph resourceGraph) + : base(schemaGenerationTracer, metaSchemaGenerator, linksVisibilitySchemaGenerator, options) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(atomicOperationCodeSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataSchemaGenerator); + ArgumentNullException.ThrowIfNull(relationshipIdentifierSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); + ArgumentNullException.ThrowIfNull(atomicOperationFilter); + ArgumentNullException.ThrowIfNull(schemaIdSelector); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultSchemaGenerator = defaultSchemaGenerator; + _atomicOperationCodeSchemaGenerator = atomicOperationCodeSchemaGenerator; + _dataSchemaGenerator = dataSchemaGenerator; + _relationshipIdentifierSchemaGenerator = relationshipIdentifierSchemaGenerator; + _dataContainerSchemaGenerator = dataContainerSchemaGenerator; + _metaSchemaGenerator = metaSchemaGenerator; + _atomicOperationFilter = atomicOperationFilter; + _schemaIdSelector = schemaIdSelector; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + _resourceGraph = resourceGraph; + } + + public override bool CanGenerate(Type schemaType) + { + return schemaType == typeof(OperationsRequestDocument) || schemaType == typeof(OperationsResponseDocument); + } + + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + bool isRequestSchema = schemaType == typeof(OperationsRequestDocument); + + if (isRequestSchema) + { + GenerateSchemasForRequestDocument(schemaRepository); + } + else + { + GenerateSchemasForResponseDocument(schemaRepository); + } + + return _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + } + + private void GenerateSchemasForRequestDocument(SchemaRepository schemaRepository) + { + _ = GenerateSchemaForAbstractOperation(schemaRepository); + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes().Where(resourceType => resourceType.BaseType == null)) + { + GenerateSchemaForOperation(resourceType, schemaRepository); + } + } + + private OpenApiSchema GenerateSchemaForAbstractOperation(SchemaRepository schemaRepository) + { + if (schemaRepository.TryLookupByType(AtomicOperationAbstractType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, AtomicOperationAbstractType); + + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + + var fullSchema = new OpenApiSchema + { + Type = "object", + Required = new SortedSet([OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName]), + Properties = new Dictionary + { + [OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName] = new() + { + Type = "string" + }, + [referenceSchemaForMeta.Reference.Id] = referenceSchemaForMeta.WrapInExtendedSchema() + }, + AdditionalPropertiesAllowed = false, + Discriminator = new OpenApiDiscriminator + { + PropertyName = OpenApiMediaTypeExtension.FullyQualifiedOpenApiDiscriminatorPropertyName, + Mapping = new SortedDictionary(StringComparer.Ordinal) + }, + Extensions = + { + ["x-abstract"] = new OpenApiBoolean(true) + } + }; + + string schemaId = _schemaIdSelector.GetSchemaId(AtomicOperationAbstractType); + + referenceSchema = schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(AtomicOperationAbstractType, schemaId); + + traceScope.TraceSucceeded(schemaId); + return referenceSchema; + } + + private void GenerateSchemaForOperation(ResourceType resourceType, SchemaRepository schemaRepository) + { + GenerateSchemaForResourceOperation(typeof(CreateOperation<>), resourceType, AtomicOperationCode.Add, schemaRepository); + GenerateSchemaForResourceOperation(typeof(UpdateOperation<>), resourceType, AtomicOperationCode.Update, schemaRepository); + GenerateSchemaForResourceOperation(typeof(DeleteOperation<>), resourceType, AtomicOperationCode.Remove, schemaRepository); + + foreach (RelationshipAttribute relationship in GetRelationshipsInTypeHierarchy(resourceType)) + { + if (relationship is HasOneAttribute) + { + GenerateSchemaForRelationshipOperation(typeof(UpdateToOneRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); + } + else + { + GenerateSchemaForRelationshipOperation(typeof(AddToRelationshipOperation<>), relationship, AtomicOperationCode.Add, schemaRepository); + GenerateSchemaForRelationshipOperation(typeof(UpdateToManyRelationshipOperation<>), relationship, AtomicOperationCode.Update, schemaRepository); + GenerateSchemaForRelationshipOperation(typeof(RemoveFromRelationshipOperation<>), relationship, AtomicOperationCode.Remove, schemaRepository); + } + } + } + + private void GenerateSchemaForResourceOperation(Type operationOpenType, ResourceType resourceType, AtomicOperationCode operationCode, + SchemaRepository schemaRepository) + { + WriteOperationKind writeOperation = GetKindOfResourceOperation(operationCode); + + if (IsResourceTypeEnabled(resourceType, writeOperation)) + { + Type operationConstructedType = ChangeResourceTypeInSchemaType(operationOpenType, resourceType); + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, operationConstructedType); + + bool needsEmptyDerivedSchema = resourceType.BaseType != null && _atomicOperationFilter.IsEnabled(resourceType.BaseType, writeOperation); + + if (!needsEmptyDerivedSchema) + { + Type identifierSchemaType = typeof(IdentifierInRequest<>).MakeGenericType(resourceType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(identifierSchemaType, true, schemaRepository); + + bool hasDataProperty = operationOpenType != typeof(DeleteOperation<>); + + if (hasDataProperty) + { + _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, resourceType, true, false, schemaRepository); + } + } + + OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); + OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; + fullSchemaForOperation.AdditionalPropertiesAllowed = false; + OpenApiSchema inlineSchemaForOperation = fullSchemaForOperation.UnwrapLastExtendedSchema(); + + if (needsEmptyDerivedSchema) + { + Type baseOperationSchemaType = ChangeResourceTypeInSchemaType(operationOpenType, resourceType.BaseType!); + OpenApiSchema referenceSchemaForBaseOperation = schemaRepository.LookupByType(baseOperationSchemaType); + + RemoveProperties(inlineSchemaForOperation); + fullSchemaForOperation.AllOf[0] = referenceSchemaForBaseOperation; + } + else + { + SetOperationCode(inlineSchemaForOperation, operationCode, schemaRepository); + } + + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, resourceType); + MapInDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); + + traceScope.TraceSucceeded(referenceSchemaForOperation.Reference.Id); + } + + foreach (ResourceType derivedType in resourceType.DirectlyDerivedTypes) + { + GenerateSchemaForResourceOperation(operationOpenType, derivedType, operationCode, schemaRepository); + } + } + + private static WriteOperationKind GetKindOfResourceOperation(AtomicOperationCode operationCode) + { + WriteOperationKind? writeOperation = null; + + if (operationCode == AtomicOperationCode.Add) + { + writeOperation = WriteOperationKind.CreateResource; + } + else if (operationCode == AtomicOperationCode.Update) + { + writeOperation = WriteOperationKind.UpdateResource; + } + else if (operationCode == AtomicOperationCode.Remove) + { + writeOperation = WriteOperationKind.DeleteResource; + } + + ConsistencyGuard.ThrowIf(writeOperation == null); + return writeOperation.Value; + } + + private bool IsResourceTypeEnabled(ResourceType resourceType, WriteOperationKind writeOperation) + { + return _atomicOperationFilter.IsEnabled(resourceType, writeOperation); + } + + private static Type ChangeResourceTypeInSchemaType(Type schemaOpenType, ResourceType resourceType) + { + return schemaOpenType.MakeGenericType(resourceType.ClrType); + } + + private static void RemoveProperties(OpenApiSchema fullSchema) + { + foreach (string propertyName in fullSchema.Properties.Keys) + { + fullSchema.Properties.Remove(propertyName); + fullSchema.Required.Remove(propertyName); + } + } + + private void SetOperationCode(OpenApiSchema fullSchema, AtomicOperationCode operationCode, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchema = _atomicOperationCodeSchemaGenerator.GenerateSchema(operationCode, schemaRepository); + fullSchema.Properties[JsonApiPropertyName.Op] = referenceSchema.WrapInExtendedSchema(); + } + + private static void MapInDiscriminator(OpenApiSchema referenceSchemaForOperation, string discriminatorValue, SchemaRepository schemaRepository) + { + OpenApiSchema referenceSchemaForAbstractOperation = schemaRepository.LookupByType(AtomicOperationAbstractType); + OpenApiSchema fullSchemaForAbstractOperation = schemaRepository.Schemas[referenceSchemaForAbstractOperation.Reference.Id]; + fullSchemaForAbstractOperation.Discriminator.Mapping.Add(discriminatorValue, referenceSchemaForOperation.Reference.ReferenceV3); + } + + private static HashSet GetRelationshipsInTypeHierarchy(ResourceType baseType) + { + HashSet relationships = baseType.Relationships.ToHashSet(); + + if (baseType.IsPartOfTypeHierarchy()) + { + IncludeRelationshipsInDirectlyDerivedTypes(baseType, relationships); + } + + return relationships; + } + + private static void IncludeRelationshipsInDirectlyDerivedTypes(ResourceType baseType, HashSet relationships) + { + foreach (ResourceType derivedType in baseType.DirectlyDerivedTypes) + { + IncludeRelationshipsInDerivedType(derivedType, relationships); + } + } + + private static void IncludeRelationshipsInDerivedType(ResourceType derivedType, HashSet relationships) + { + foreach (RelationshipAttribute relationshipInDerivedType in derivedType.Relationships) + { + relationships.Add(relationshipInDerivedType); + } + + IncludeRelationshipsInDirectlyDerivedTypes(derivedType, relationships); + } + + private void GenerateSchemaForRelationshipOperation(Type operationOpenType, RelationshipAttribute relationship, AtomicOperationCode operationCode, + SchemaRepository schemaRepository) + { + WriteOperationKind writeOperation = GetKindOfRelationshipOperation(operationCode); + + if (!IsRelationshipEnabled(relationship, writeOperation)) + { + return; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, operationOpenType, relationship); + + RelationshipAttribute? relationshipInAnyBaseResourceType = GetRelationshipEnabledInAnyBase(relationship, writeOperation); + + OpenApiSchema? referenceSchemaForRelationshipIdentifier; + + if (relationshipInAnyBaseResourceType == null) + { + Type rightSchemaType = typeof(IdentifierInRequest<>).MakeGenericType(relationship.RightType.ClrType); + _ = _dataSchemaGenerator.GenerateSchema(rightSchemaType, true, schemaRepository); + + referenceSchemaForRelationshipIdentifier = _relationshipIdentifierSchemaGenerator.GenerateSchema(relationship, schemaRepository); + } + else + { + referenceSchemaForRelationshipIdentifier = null; + } + + Type operationConstructedType = ChangeResourceTypeInSchemaType(operationOpenType, relationship.RightType); + _ = _dataContainerSchemaGenerator.GenerateSchema(operationConstructedType, relationship.RightType, true, false, schemaRepository); + + // This complicated implementation that generates a temporary schema stems from the fact that GetSchemaId takes a Type. + // We could feed it a constructed type with TLeftResource and TRightResource, but there's no way to include + // the relationship name because there's no runtime Type available for it. + string schemaId = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationship, operationCode); + + OpenApiSchema referenceSchemaForOperation = _defaultSchemaGenerator.GenerateSchema(operationConstructedType, schemaRepository); + OpenApiSchema fullSchemaForOperation = schemaRepository.Schemas[referenceSchemaForOperation.Reference.Id]; + fullSchemaForOperation.AdditionalPropertiesAllowed = false; + + OpenApiSchema inlineSchemaForOperation = fullSchemaForOperation.UnwrapLastExtendedSchema(); + SetOperationCode(inlineSchemaForOperation, operationCode, schemaRepository); + + if (referenceSchemaForRelationshipIdentifier != null) + { + inlineSchemaForOperation.Properties[JsonApiPropertyName.Ref] = referenceSchemaForRelationshipIdentifier.WrapInExtendedSchema(); + } + + inlineSchemaForOperation.Properties[JsonApiPropertyName.Data].Nullable = _resourceFieldValidationMetadataProvider.IsNullable(relationship); + + schemaRepository.ReplaceSchemaId(operationConstructedType, schemaId); + referenceSchemaForOperation.Reference.Id = schemaId; + + if (relationshipInAnyBaseResourceType != null) + { + RemoveProperties(inlineSchemaForOperation); + + string baseRelationshipSchemaId = _schemaIdSelector.GetRelationshipAtomicOperationSchemaId(relationshipInAnyBaseResourceType, operationCode); + ConsistencyGuard.ThrowIf(!schemaRepository.Schemas.ContainsKey(baseRelationshipSchemaId)); + + fullSchemaForOperation.AllOf[0] = new OpenApiSchema + { + Reference = new OpenApiReference + { + Id = baseRelationshipSchemaId, + Type = ReferenceType.Schema + } + }; + } + + string discriminatorValue = _schemaIdSelector.GetAtomicOperationDiscriminatorValue(operationCode, relationship); + MapInDiscriminator(referenceSchemaForOperation, discriminatorValue, schemaRepository); + + traceScope.TraceSucceeded(schemaId); + } + + private static WriteOperationKind GetKindOfRelationshipOperation(AtomicOperationCode operationCode) + { + WriteOperationKind? writeOperation = null; + + if (operationCode == AtomicOperationCode.Add) + { + writeOperation = WriteOperationKind.AddToRelationship; + } + else if (operationCode == AtomicOperationCode.Update) + { + writeOperation = WriteOperationKind.SetRelationship; + } + else if (operationCode == AtomicOperationCode.Remove) + { + writeOperation = WriteOperationKind.RemoveFromRelationship; + } + + ConsistencyGuard.ThrowIf(writeOperation == null); + return writeOperation.Value; + } + + private bool IsRelationshipEnabled(RelationshipAttribute relationship, WriteOperationKind writeOperation) + { + if (!_atomicOperationFilter.IsEnabled(relationship.LeftType, writeOperation)) + { + return false; + } + + if (relationship is HasOneAttribute hasOneRelationship && !IsToOneRelationshipEnabled(hasOneRelationship, writeOperation)) + { + return false; + } + + if (relationship is HasManyAttribute hasManyRelationship && !IsToManyRelationshipEnabled(hasManyRelationship, writeOperation)) + { + return false; + } + + return true; + } + + private static bool IsToOneRelationshipEnabled(HasOneAttribute relationship, WriteOperationKind writeOperation) + { + bool? isEnabled = null; + + if (writeOperation == WriteOperationKind.SetRelationship) + { + isEnabled = relationship.Capabilities.HasFlag(HasOneCapabilities.AllowSet); + } + + ConsistencyGuard.ThrowIf(isEnabled == null); + return isEnabled.Value; + } + + private static bool IsToManyRelationshipEnabled(HasManyAttribute relationship, WriteOperationKind writeOperation) + { + bool? isEnabled = null; + + if (writeOperation == WriteOperationKind.SetRelationship) + { + isEnabled = relationship.Capabilities.HasFlag(HasManyCapabilities.AllowSet); + } + else if (writeOperation == WriteOperationKind.AddToRelationship) + { + isEnabled = relationship.Capabilities.HasFlag(HasManyCapabilities.AllowAdd); + } + else if (writeOperation == WriteOperationKind.RemoveFromRelationship) + { + isEnabled = relationship.Capabilities.HasFlag(HasManyCapabilities.AllowRemove); + } + + ConsistencyGuard.ThrowIf(isEnabled == null); + return isEnabled.Value; + } + + private RelationshipAttribute? GetRelationshipEnabledInAnyBase(RelationshipAttribute relationship, WriteOperationKind writeOperation) + { + RelationshipAttribute? relationshipInBaseResourceType = relationship.LeftType.BaseType?.FindRelationshipByPublicName(relationship.PublicName); + + while (relationshipInBaseResourceType != null) + { + if (IsRelationshipEnabled(relationshipInBaseResourceType, writeOperation)) + { + return relationshipInBaseResourceType; + } + + relationshipInBaseResourceType = relationshipInBaseResourceType.LeftType.BaseType?.FindRelationshipByPublicName(relationship.PublicName); + } + + return null; + } + + private void GenerateSchemasForResponseDocument(SchemaRepository schemaRepository) + { + _ = _dataContainerSchemaGenerator.GenerateSchemaForCommonResourceDataInResponse(schemaRepository); + + foreach (ResourceType resourceType in _resourceGraph.GetResourceTypes()) + { + if (IsResourceTypeEnabled(resourceType, WriteOperationKind.CreateResource) || + IsResourceTypeEnabled(resourceType, WriteOperationKind.UpdateResource)) + { + _ = _dataContainerSchemaGenerator.GenerateSchema(typeof(AtomicResult), resourceType, false, false, schemaRepository); + } + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs new file mode 100644 index 0000000000..740b2fca43 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/DocumentSchemaGenerator.cs @@ -0,0 +1,69 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for a request and/or response document. +/// +internal abstract class DocumentSchemaGenerator +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; + private readonly IJsonApiOptions _options; + + protected DocumentSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, MetaSchemaGenerator metaSchemaGenerator, + LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(metaSchemaGenerator); + ArgumentNullException.ThrowIfNull(linksVisibilitySchemaGenerator); + ArgumentNullException.ThrowIfNull(options); + + _schemaGenerationTracer = schemaGenerationTracer; + _metaSchemaGenerator = metaSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; + _options = options; + } + + public abstract bool CanGenerate(Type schemaType); + + public OpenApiSchema GenerateSchema(Type schemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (schemaRepository.TryLookupByType(schemaType, out OpenApiSchema? referenceSchema)) + { + return referenceSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, schemaType); + + _metaSchemaGenerator.GenerateSchema(schemaRepository); + + referenceSchema = GenerateDocumentSchema(schemaType, schemaRepository); + OpenApiSchema fullSchema = schemaRepository.Schemas[referenceSchema.Reference.Id]; + + _linksVisibilitySchemaGenerator.UpdateSchemaForTopLevel(schemaType, fullSchema, schemaRepository); + + SetJsonApiVersion(fullSchema, schemaRepository); + + traceScope.TraceSucceeded(referenceSchema.Reference.Id); + return referenceSchema; + } + + protected abstract OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository); + + private void SetJsonApiVersion(OpenApiSchema fullSchema, SchemaRepository schemaRepository) + { + if (fullSchema.Properties.ContainsKey(JsonApiPropertyName.Jsonapi) && !_options.IncludeJsonApiVersion) + { + fullSchema.Properties.Remove(JsonApiPropertyName.Jsonapi); + schemaRepository.Schemas.Remove(JsonApiPropertyName.Jsonapi); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs new file mode 100644 index 0000000000..3d305e889b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ErrorResponseDocumentSchemaGenerator.cs @@ -0,0 +1,60 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.Serialization.Objects; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for an error document. +/// +internal sealed class ErrorResponseDocumentSchemaGenerator : DocumentSchemaGenerator +{ + private static readonly Type ErrorObjectType = typeof(ErrorObject); + + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly MetaSchemaGenerator _metaSchemaGenerator; + + public ErrorResponseDocumentSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + MetaSchemaGenerator metaSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options) + : base(schemaGenerationTracer, metaSchemaGenerator, linksVisibilitySchemaGenerator, options) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultSchemaGenerator = defaultSchemaGenerator; + _metaSchemaGenerator = metaSchemaGenerator; + } + + public override bool CanGenerate(Type schemaType) + { + return schemaType == typeof(ErrorResponseDocument); + } + + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + OpenApiSchema referenceSchemaForErrorObject = GenerateSchemaForErrorObject(schemaRepository); + OpenApiSchema fullSchemaForErrorObject = schemaRepository.Schemas[referenceSchemaForErrorObject.Reference.Id]; + + OpenApiSchema referenceSchemaForMeta = _metaSchemaGenerator.GenerateSchema(schemaRepository); + fullSchemaForErrorObject.Properties[JsonApiPropertyName.Meta] = referenceSchemaForMeta.WrapInExtendedSchema(); + + return _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + } + + private OpenApiSchema GenerateSchemaForErrorObject(SchemaRepository schemaRepository) + { + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, ErrorObjectType); + + OpenApiSchema referenceSchema = _defaultSchemaGenerator.GenerateSchema(ErrorObjectType, schemaRepository); + + traceScope.TraceSucceeded(referenceSchema.Reference.Id); + return referenceSchema; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs new file mode 100644 index 0000000000..767f0d0143 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Documents/ResourceOrRelationshipDocumentSchemaGenerator.cs @@ -0,0 +1,80 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; + +/// +/// Generates the OpenAPI component schema for a resource/relationship request/response document. +/// +internal sealed class ResourceOrRelationshipDocumentSchemaGenerator : DocumentSchemaGenerator +{ + private static readonly Type[] RequestDocumentSchemaTypes = + [ + typeof(CreateRequestDocument<>), + typeof(UpdateRequestDocument<>), + typeof(ToOneInRequest<>), + typeof(NullableToOneInRequest<>), + typeof(ToManyInRequest<>) + ]; + + private static readonly Type[] ResponseDocumentSchemaTypes = + [ + typeof(CollectionResponseDocument<>), + typeof(PrimaryResponseDocument<>), + typeof(SecondaryResponseDocument<>), + typeof(NullableSecondaryResponseDocument<>), + typeof(IdentifierResponseDocument<>), + typeof(NullableIdentifierResponseDocument<>), + typeof(IdentifierCollectionResponseDocument<>) + ]; + + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly DataContainerSchemaGenerator _dataContainerSchemaGenerator; + private readonly IResourceGraph _resourceGraph; + + public ResourceOrRelationshipDocumentSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + DataContainerSchemaGenerator dataContainerSchemaGenerator, MetaSchemaGenerator metaSchemaGenerator, + LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, IJsonApiOptions options, IResourceGraph resourceGraph) + : base(schemaGenerationTracer, metaSchemaGenerator, linksVisibilitySchemaGenerator, options) + { + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataContainerSchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _defaultSchemaGenerator = defaultSchemaGenerator; + _dataContainerSchemaGenerator = dataContainerSchemaGenerator; + _resourceGraph = resourceGraph; + } + + public override bool CanGenerate(Type schemaType) + { + Type schemaOpenType = schemaType.ConstructedToOpenType(); + return RequestDocumentSchemaTypes.Contains(schemaOpenType) || ResponseDocumentSchemaTypes.Contains(schemaOpenType); + } + + protected override OpenApiSchema GenerateDocumentSchema(Type schemaType, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + var resourceSchemaType = ResourceSchemaType.Create(schemaType, _resourceGraph); + bool isRequestSchema = RequestDocumentSchemaTypes.Contains(resourceSchemaType.SchemaOpenType); + + _ = _dataContainerSchemaGenerator.GenerateSchema(schemaType, resourceSchemaType.ResourceType, isRequestSchema, !isRequestSchema, schemaRepository); + + OpenApiSchema? referenceSchemaForDocument = _defaultSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + OpenApiSchema inlineSchemaForDocument = schemaRepository.Schemas[referenceSchemaForDocument.Reference.Id].UnwrapLastExtendedSchema(); + + if (JsonApiSchemaFacts.HasNullableDataProperty(resourceSchemaType.SchemaOpenType)) + { + inlineSchemaForDocument.Properties[JsonApiPropertyName.Data].Nullable = true; + } + + return referenceSchemaForDocument; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs new file mode 100644 index 0000000000..beba632ebf --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/GenerationCacheSchemaGenerator.cs @@ -0,0 +1,93 @@ +using System.Reflection; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using Microsoft.AspNetCore.Mvc.Abstractions; +using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; + +/// +/// Provides access to cached state, which is stored in a temporary schema in during schema generation. +/// +internal sealed class GenerationCacheSchemaGenerator +{ + private const string HasAtomicOperationsEndpointPropertyName = "HasAtomicOperationsEndpoint"; + public const string SchemaId = "__JsonApiSchemaGenerationCache__"; + + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly IActionDescriptorCollectionProvider _defaultProvider; + private readonly JsonApiEndpointMetadataProvider _jsonApiEndpointMetadataProvider; + + public GenerationCacheSchemaGenerator(SchemaGenerationTracer schemaGenerationTracer, IActionDescriptorCollectionProvider defaultProvider, + JsonApiEndpointMetadataProvider jsonApiEndpointMetadataProvider) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(defaultProvider); + ArgumentNullException.ThrowIfNull(jsonApiEndpointMetadataProvider); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultProvider = defaultProvider; + _jsonApiEndpointMetadataProvider = jsonApiEndpointMetadataProvider; + } + + public bool HasAtomicOperationsEndpoint(SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + + OpenApiSchema fullSchema = GenerateFullSchema(schemaRepository); + + var hasAtomicOperationsEndpoint = (OpenApiBoolean)fullSchema.Properties[HasAtomicOperationsEndpointPropertyName].Default; + return hasAtomicOperationsEndpoint.Value; + } + + private OpenApiSchema GenerateFullSchema(SchemaRepository schemaRepository) + { + if (schemaRepository.Schemas.TryGetValue(SchemaId, out OpenApiSchema? fullSchema)) + { + return fullSchema; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this); + + bool hasAtomicOperationsEndpoint = EvaluateHasAtomicOperationsEndpoint(); + + fullSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary + { + [HasAtomicOperationsEndpointPropertyName] = new() + { + Type = "boolean", + Default = new OpenApiBoolean(hasAtomicOperationsEndpoint) + } + } + }; + + schemaRepository.AddDefinition(SchemaId, fullSchema); + + traceScope.TraceSucceeded(SchemaId); + return fullSchema; + } + + private bool EvaluateHasAtomicOperationsEndpoint() + { + IEnumerable actionDescriptors = + _defaultProvider.ActionDescriptors.Items.Where(JsonApiActionDescriptorCollectionProvider.IsVisibleJsonApiEndpoint); + + foreach (ActionDescriptor actionDescriptor in actionDescriptors) + { + MethodInfo actionMethod = actionDescriptor.GetActionMethod(); + JsonApiEndpointMetadataContainer endpointMetadataContainer = _jsonApiEndpointMetadataProvider.Get(actionMethod); + + if (endpointMetadataContainer.RequestMetadata is AtomicOperationsRequestMetadata) + { + return true; + } + } + + return false; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs new file mode 100644 index 0000000000..19d94eb48e --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/JsonApiSchemaGenerator.cs @@ -0,0 +1,70 @@ +using System.Reflection; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; + +internal sealed class JsonApiSchemaGenerator : ISchemaGenerator +{ + private readonly ResourceIdSchemaGenerator _resourceIdSchemaGenerator; + private readonly DocumentSchemaGenerator[] _documentSchemaGenerators; + + public JsonApiSchemaGenerator(ResourceIdSchemaGenerator resourceIdSchemaGenerator, IEnumerable documentSchemaGenerators) + { + ArgumentNullException.ThrowIfNull(resourceIdSchemaGenerator); + ArgumentNullException.ThrowIfNull(documentSchemaGenerators); + + _resourceIdSchemaGenerator = resourceIdSchemaGenerator; + _documentSchemaGenerators = documentSchemaGenerators as DocumentSchemaGenerator[] ?? documentSchemaGenerators.ToArray(); + } + + public OpenApiSchema GenerateSchema(Type schemaType, SchemaRepository schemaRepository, MemberInfo? memberInfo = null, ParameterInfo? parameterInfo = null, + ApiParameterRouteInfo? routeInfo = null) + { + ArgumentNullException.ThrowIfNull(schemaType); + ArgumentNullException.ThrowIfNull(schemaRepository); + + if (parameterInfo is { Name: "id" } && IsJsonApiParameter(parameterInfo)) + { + return _resourceIdSchemaGenerator.GenerateSchema(schemaType, schemaRepository); + } + + DocumentSchemaGenerator schemaGenerator = GetDocumentSchemaGenerator(schemaType); + OpenApiSchema referenceSchema = schemaGenerator.GenerateSchema(schemaType, schemaRepository); + + if (memberInfo != null || parameterInfo != null) + { + // For unknown reasons, Swashbuckle chooses to wrap request bodies in allOf, but not response bodies. + // We just replicate that behavior here. See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/861#issuecomment-1373631712. + referenceSchema = referenceSchema.WrapInExtendedSchema(); + } + + return referenceSchema; + } + + private static bool IsJsonApiParameter(ParameterInfo parameter) + { + return parameter.Member.DeclaringType != null && parameter.Member.DeclaringType.IsAssignableTo(typeof(CoreJsonApiController)); + } + + private DocumentSchemaGenerator GetDocumentSchemaGenerator(Type schemaType) + { + DocumentSchemaGenerator? generator = null; + + foreach (DocumentSchemaGenerator documentSchemaGenerator in _documentSchemaGenerators) + { + if (documentSchemaGenerator.CanGenerate(schemaType)) + { + generator = documentSchemaGenerator; + break; + } + } + + ConsistencyGuard.ThrowIf(generator == null); + return generator; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs new file mode 100644 index 0000000000..669c50b4e0 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaRepositoryExtensions.cs @@ -0,0 +1,63 @@ +using System.Reflection; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class SchemaRepositoryExtensions +{ + private const string ReservedIdsFieldName = "_reservedIds"; + private static readonly FieldInfo ReservedIdsField = GetReservedIdsField(); + + private static FieldInfo GetReservedIdsField() + { + FieldInfo? field = typeof(SchemaRepository).GetField(ReservedIdsFieldName, BindingFlags.Instance | BindingFlags.NonPublic); + + if (field == null) + { + throw new InvalidOperationException($"Failed to locate private field '{ReservedIdsFieldName}' " + + $"in type '{typeof(SchemaRepository).FullName}' in assembly '{typeof(SchemaRepository).Assembly.FullName}'."); + } + + if (field.FieldType != typeof(Dictionary)) + { + throw new InvalidOperationException($"Unexpected type '{field.FieldType}' of private field '{ReservedIdsFieldName}' " + + $"in type '{typeof(SchemaRepository).FullName}' in assembly '{typeof(SchemaRepository).Assembly.FullName}'."); + } + + return field; + } + + public static OpenApiSchema LookupByType(this SchemaRepository schemaRepository, Type schemaType) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + ArgumentNullException.ThrowIfNull(schemaType); + + if (!schemaRepository.TryLookupByType(schemaType, out OpenApiSchema? referenceSchema)) + { + throw new InvalidOperationException($"Reference schema for '{schemaType.Name}' does not exist."); + } + + return referenceSchema; + } + + public static void ReplaceSchemaId(this SchemaRepository schemaRepository, Type oldSchemaType, string newSchemaId) + { + ArgumentNullException.ThrowIfNull(schemaRepository); + ArgumentNullException.ThrowIfNull(oldSchemaType); + ArgumentException.ThrowIfNullOrEmpty(newSchemaId); + + if (schemaRepository.TryLookupByType(oldSchemaType, out OpenApiSchema? referenceSchema)) + { + string oldSchemaId = referenceSchema.Reference.Id; + + OpenApiSchema fullSchema = schemaRepository.Schemas[oldSchemaId]; + + schemaRepository.Schemas.Remove(oldSchemaId); + schemaRepository.Schemas.Add(newSchemaId, fullSchema); + + var reservedIds = (Dictionary)ReservedIdsField.GetValue(schemaRepository)!; + reservedIds.Remove(oldSchemaType); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs new file mode 100644 index 0000000000..df5247d9de --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs @@ -0,0 +1,115 @@ +using System.Diagnostics.CodeAnalysis; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; +using JsonApiDotNetCore.Serialization.Response; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +public static class ServiceCollectionExtensions +{ + /// + /// Configures OpenAPI for JsonApiDotNetCore using Swashbuckle. + /// + [Experimental("JADNC_OA_001", UrlFormat = "https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/docs/usage/openapi.md")] + public static void AddOpenApiForJsonApi(this IServiceCollection services, Action? configureSwaggerGenOptions = null) + { + ArgumentNullException.ThrowIfNull(services); + + AddCustomApiExplorer(services); + AddCustomSwaggerComponents(services); + AddSwaggerGenerator(services); + + if (configureSwaggerGenOptions != null) + { + services.Configure(configureSwaggerGenOptions); + } + + services.AddSingleton(); + services.TryAddSingleton(); + services.Replace(ServiceDescriptor.Singleton()); + } + + private static void AddCustomApiExplorer(IServiceCollection services) + { + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + + // Not using TryAddSingleton, see https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1463. + services.Replace(ServiceDescriptor.Singleton(serviceProvider => + { + var actionDescriptorCollectionProvider = serviceProvider.GetRequiredService(); + var apiDescriptionProviders = serviceProvider.GetRequiredService>(); + + return new ApiDescriptionGroupCollectionProvider(actionDescriptorCollectionProvider, apiDescriptionProviders); + })); + + AddApiExplorer(services); + + services.AddSingleton, ConfigureMvcOptions>(); + } + + private static void AddApiExplorer(IServiceCollection services) + { + // The code below was copied from the implementation of MvcApiExplorerMvcCoreBuilderExtensions.AddApiExplorer(), + // so we don't need to take IMvcCoreBuilder as an input parameter. + + services.TryAddEnumerable(ServiceDescriptor.Transient()); + } + + private static void AddCustomSwaggerComponents(IServiceCollection services) + { + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + } + + private static void AddSwaggerGenerator(IServiceCollection services) + { + AddSchemaGenerators(services); + + services.TryAddSingleton(); + services.AddSingleton(); + + services.AddSwaggerGen(); + services.AddSingleton, ConfigureSwaggerGenOptions>(); + } + + private static void AddSchemaGenerators(IServiceCollection services) + { + services.TryAddSingleton(); + services.TryAddSingleton(); + + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); + + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + + services.TryAddSingleton(); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs new file mode 100644 index 0000000000..2764f868e6 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SetSchemaTypeToObjectDocumentFilter.cs @@ -0,0 +1,23 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class SetSchemaTypeToObjectDocumentFilter : IDocumentFilter +{ + internal const string RequiresRootObjectTypeKey = "x-requires-root-object-type"; + + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + foreach (OpenApiSchema schema in document.Components.Schemas.Values) + { + if (schema.Extensions.ContainsKey(RequiresRootObjectTypeKey)) + { + schema.Type = "object"; + schema.Extensions.Remove(RequiresRootObjectTypeKey); + } + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/DocumentationOpenApiOperationFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/DocumentationOpenApiOperationFilter.cs new file mode 100644 index 0000000000..1b5c0d5f4c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/DocumentationOpenApiOperationFilter.cs @@ -0,0 +1,596 @@ +using System.Net; +using System.Reflection; +using Humanizer; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.Net.Http.Headers; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class DocumentationOpenApiOperationFilter : IOperationFilter +{ + private const string GetPrimaryName = nameof(BaseJsonApiController, int>.GetAsync); + private const string GetSecondaryName = nameof(BaseJsonApiController, int>.GetSecondaryAsync); + private const string GetRelationshipName = nameof(BaseJsonApiController, int>.GetRelationshipAsync); + private const string PostResourceName = nameof(BaseJsonApiController, int>.PostAsync); + private const string PostRelationshipName = nameof(BaseJsonApiController, int>.PostRelationshipAsync); + private const string PatchResourceName = nameof(BaseJsonApiController, int>.PatchAsync); + private const string PatchRelationshipName = nameof(BaseJsonApiController, int>.PatchRelationshipAsync); + private const string DeleteResourceName = nameof(BaseJsonApiController, int>.DeleteAsync); + private const string DeleteRelationshipName = nameof(BaseJsonApiController, int>.DeleteRelationshipAsync); + private const string PostOperationsName = nameof(BaseJsonApiOperationsController.PostOperationsAsync); + + private const string TextCompareETag = + "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."; + + private const string TextCompletedSuccessfully = "The operation completed successfully."; + private const string TextNotModified = "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."; + private const string TextQueryStringBad = "The query string is invalid."; + private const string TextRequestBodyBad = "The request body is missing or malformed."; + private const string TextQueryStringOrRequestBodyBad = "The query string is invalid or the request body is missing or malformed."; + private const string TextConflict = "The request body contains conflicting information or another resource with the same ID already exists."; + private const string TextRequestBodyIncompatibleIdOrType = "A resource type or identifier in the request body is incompatible."; + private const string TextRequestBodyValidationFailed = "Validation of the request body failed."; + private const string TextRequestBodyClientId = "Client-generated IDs cannot be used at this endpoint."; + + private const string ResourceQueryStringParameters = + "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/" + + "[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/" + + "[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/" + + "[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters."; + + private const string RelationshipQueryStringParameters = "For syntax, see the documentation for the " + + "[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/" + + "[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/" + + "[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters."; + + private readonly IJsonApiOptions _options; + private readonly IControllerResourceMapping _controllerResourceMapping; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + + public DocumentationOpenApiOperationFilter(IJsonApiOptions options, IControllerResourceMapping controllerResourceMapping, + ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(controllerResourceMapping); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + + _options = options; + _controllerResourceMapping = controllerResourceMapping; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + } + + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + ArgumentNullException.ThrowIfNull(operation); + ArgumentNullException.ThrowIfNull(context); + + bool hasHeadVerb = context.ApiDescription.HttpMethod == "HEAD"; + + if (hasHeadVerb) + { + operation.Responses.Clear(); + } + + MethodInfo actionMethod = context.ApiDescription.ActionDescriptor.GetActionMethod(); + string actionName = context.MethodInfo.Name; + ResourceType? resourceType = _controllerResourceMapping.GetResourceTypeForController(actionMethod.ReflectedType); + + if (resourceType != null) + { + switch (actionName) + { + case GetPrimaryName or PostResourceName or PatchResourceName or DeleteResourceName: + { + switch (actionName) + { + case GetPrimaryName: + { + ApplyGetPrimary(operation, resourceType, hasHeadVerb); + break; + } + case PostResourceName: + { + ApplyPostResource(operation, resourceType); + break; + } + case PatchResourceName: + { + ApplyPatchResource(operation, resourceType); + break; + } + case DeleteResourceName: + { + ApplyDeleteResource(operation, resourceType); + break; + } + } + + break; + } + case GetSecondaryName or GetRelationshipName or PostRelationshipName or PatchRelationshipName or DeleteRelationshipName: + { + RelationshipAttribute relationship = GetRelationshipFromRoute(context.ApiDescription, resourceType); + + switch (actionName) + { + case GetSecondaryName: + { + ApplyGetSecondary(operation, relationship, hasHeadVerb); + break; + } + case GetRelationshipName: + { + ApplyGetRelationship(operation, relationship, hasHeadVerb); + break; + } + case PostRelationshipName: + { + ApplyPostRelationship(operation, relationship); + break; + } + case PatchRelationshipName: + { + ApplyPatchRelationship(operation, relationship); + break; + } + case DeleteRelationshipName: + { + ApplyDeleteRelationship(operation, relationship); + break; + } + } + + break; + } + } + } + else if (actionName == PostOperationsName) + { + ApplyPostOperations(operation); + } + } + + private static void ApplyGetPrimary(OpenApiOperation operation, ResourceType resourceType, bool hasHeadVerb) + { + if (operation.Parameters.Count == 0) + { + if (hasHeadVerb) + { + SetOperationSummary(operation, $"Retrieves a collection of {resourceType} without returning them."); + SetOperationRemarks(operation, TextCompareETag); + SetResponseDescription(operation.Responses, HttpStatusCode.OK, TextCompletedSuccessfully); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseHeaderContentLength(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + else + { + SetOperationSummary(operation, $"Retrieves a collection of {resourceType}."); + + SetResponseDescription(operation.Responses, HttpStatusCode.OK, + $"Successfully returns the found {resourceType}, or an empty array if none were found."); + + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + + AddQueryStringParameters(operation, false); + AddRequestHeaderIfNoneMatch(operation); + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringBad); + } + else if (operation.Parameters.Count == 1) + { + string singularName = resourceType.PublicName.Singularize(); + + if (hasHeadVerb) + { + SetOperationSummary(operation, $"Retrieves an individual {singularName} by its identifier without returning it."); + SetOperationRemarks(operation, TextCompareETag); + SetResponseDescription(operation.Responses, HttpStatusCode.OK, TextCompletedSuccessfully); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseHeaderContentLength(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + else + { + SetOperationSummary(operation, $"Retrieves an individual {singularName} by its identifier."); + SetResponseDescription(operation.Responses, HttpStatusCode.OK, $"Successfully returns the found {singularName}."); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularName} to retrieve."); + AddQueryStringParameters(operation, false); + AddRequestHeaderIfNoneMatch(operation); + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularName} does not exist."); + } + } + + private void ApplyPostResource(OpenApiOperation operation, ResourceType resourceType) + { + string singularName = resourceType.PublicName.Singularize(); + + SetOperationSummary(operation, $"Creates a new {singularName}."); + AddQueryStringParameters(operation, false); + SetRequestBodyDescription(operation.RequestBody, $"The attributes and relationships of the {singularName} to create."); + + SetResponseDescription(operation.Responses, HttpStatusCode.Created, + $"The {singularName} was successfully created, which resulted in additional changes. The newly created {singularName} is returned."); + + SetResponseHeaderLocation(operation.Responses, HttpStatusCode.Created, singularName); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + $"The {singularName} was successfully created, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringOrRequestBodyBad); + + ClientIdGenerationMode clientIdGeneration = resourceType.ClientIdGeneration ?? _options.ClientIdGeneration; + + if (clientIdGeneration == ClientIdGenerationMode.Forbidden) + { + SetResponseDescription(operation.Responses, HttpStatusCode.Forbidden, TextRequestBodyClientId); + } + + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, "A related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextConflict); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } + + private void ApplyPatchResource(OpenApiOperation operation, ResourceType resourceType) + { + string singularName = resourceType.PublicName.Singularize(); + + SetOperationSummary(operation, $"Updates an existing {singularName}."); + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularName} to update."); + AddQueryStringParameters(operation, false); + + SetRequestBodyDescription(operation.RequestBody, + $"The attributes and relationships of the {singularName} to update. Omitted fields are left unchanged."); + + SetResponseDescription(operation.Responses, HttpStatusCode.OK, + $"The {singularName} was successfully updated, which resulted in additional changes. The updated {singularName} is returned."); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + $"The {singularName} was successfully updated, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringOrRequestBodyBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularName} or a related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextRequestBodyIncompatibleIdOrType); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } + + private void ApplyDeleteResource(OpenApiOperation operation, ResourceType resourceType) + { + string singularName = resourceType.PublicName.Singularize(); + + SetOperationSummary(operation, $"Deletes an existing {singularName} by its identifier."); + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularName} to delete."); + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, $"The {singularName} was successfully deleted."); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularName} does not exist."); + } + + private static void ApplyGetSecondary(OpenApiOperation operation, RelationshipAttribute relationship, bool hasHeadVerb) + { + string singularLeftName = relationship.LeftType.PublicName.Singularize(); + string rightName = relationship is HasOneAttribute ? relationship.RightType.PublicName.Singularize() : relationship.RightType.PublicName; + + if (hasHeadVerb) + { + SetOperationSummary(operation, + relationship is HasOneAttribute + ? $"Retrieves the related {rightName} of an individual {singularLeftName}'s {relationship} relationship without returning it." + : $"Retrieves the related {rightName} of an individual {singularLeftName}'s {relationship} relationship without returning them."); + + SetOperationRemarks(operation, TextCompareETag); + SetResponseDescription(operation.Responses, HttpStatusCode.OK, TextCompletedSuccessfully); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseHeaderContentLength(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + else + { + SetOperationSummary(operation, $"Retrieves the related {rightName} of an individual {singularLeftName}'s {relationship} relationship."); + + SetResponseDescription(operation.Responses, HttpStatusCode.OK, + relationship is HasOneAttribute + ? $"Successfully returns the found {rightName}, or null if it was not found." + : $"Successfully returns the found {rightName}, or an empty array if none were found."); + + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularLeftName} whose related {rightName} to retrieve."); + AddQueryStringParameters(operation, false); + AddRequestHeaderIfNoneMatch(operation); + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularLeftName} does not exist."); + } + + private static void ApplyGetRelationship(OpenApiOperation operation, RelationshipAttribute relationship, bool hasHeadVerb) + { + string singularLeftName = relationship.LeftType.PublicName.Singularize(); + string singularRightName = relationship.RightType.PublicName.Singularize(); + string ident = relationship is HasOneAttribute ? "identity" : "identities"; + + if (hasHeadVerb) + { + SetOperationSummary(operation, + relationship is HasOneAttribute + ? $"Retrieves the related {singularRightName} {ident} of an individual {singularLeftName}'s {relationship} relationship without returning it." + : $"Retrieves the related {singularRightName} {ident} of an individual {singularLeftName}'s {relationship} relationship without returning them."); + + SetOperationRemarks(operation, TextCompareETag); + SetResponseDescription(operation.Responses, HttpStatusCode.OK, TextCompletedSuccessfully); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseHeaderContentLength(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + else + { + SetOperationSummary(operation, + $"Retrieves the related {singularRightName} {ident} of an individual {singularLeftName}'s {relationship} relationship."); + + SetResponseDescription(operation.Responses, HttpStatusCode.OK, + relationship is HasOneAttribute + ? $"Successfully returns the found {singularRightName} {ident}, or null if it was not found." + : $"Successfully returns the found {singularRightName} {ident}, or an empty array if none were found."); + + SetResponseHeaderETag(operation.Responses, HttpStatusCode.OK); + SetResponseDescription(operation.Responses, HttpStatusCode.NotModified, TextNotModified); + SetResponseHeaderETag(operation.Responses, HttpStatusCode.NotModified); + } + + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularLeftName} whose related {singularRightName} {ident} to retrieve."); + AddQueryStringParameters(operation, true); + AddRequestHeaderIfNoneMatch(operation); + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextQueryStringBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularLeftName} does not exist."); + } + + private void ApplyPostRelationship(OpenApiOperation operation, RelationshipAttribute relationship) + { + string singularLeftName = relationship.LeftType.PublicName.Singularize(); + string rightName = relationship.RightType.PublicName; + + SetOperationSummary(operation, $"Adds existing {rightName} to the {relationship} relationship of an individual {singularLeftName}."); + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularLeftName} to add {rightName} to."); + SetRequestBodyDescription(operation.RequestBody, $"The identities of the {rightName} to add to the {relationship} relationship."); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + $"The {rightName} were successfully added, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextRequestBodyBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularLeftName} or a related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextConflict); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } + + private void ApplyPatchRelationship(OpenApiOperation operation, RelationshipAttribute relationship) + { + bool isOptional = _resourceFieldValidationMetadataProvider.IsNullable(relationship); + string singularLeftName = relationship.LeftType.PublicName.Singularize(); + string rightName = relationship is HasOneAttribute ? relationship.RightType.PublicName.Singularize() : relationship.RightType.PublicName; + + SetOperationSummary(operation, + relationship is HasOneAttribute + ? isOptional + ? $"Clears or assigns an existing {rightName} to the {relationship} relationship of an individual {singularLeftName}." + : $"Assigns an existing {rightName} to the {relationship} relationship of an individual {singularLeftName}." + : $"Assigns existing {rightName} to the {relationship} relationship of an individual {singularLeftName}."); + + SetParameterDescription(operation.Parameters[0], + isOptional + ? $"The identifier of the {singularLeftName} whose {relationship} relationship to assign or clear." + : $"The identifier of the {singularLeftName} whose {relationship} relationship to assign."); + + SetRequestBodyDescription(operation.RequestBody, + relationship is HasOneAttribute + ? isOptional + ? $"The identity of the {rightName} to assign to the {relationship} relationship, or null to clear the relationship." + : $"The identity of the {rightName} to assign to the {relationship} relationship." + : $"The identities of the {rightName} to assign to the {relationship} relationship, or an empty array to clear the relationship."); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + $"The {relationship} relationship was successfully updated, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextRequestBodyBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularLeftName} or a related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextConflict); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } + + private void ApplyDeleteRelationship(OpenApiOperation operation, RelationshipAttribute relationship) + { + string singularLeftName = relationship.LeftType.PublicName.Singularize(); + string rightName = relationship.RightType.PublicName; + + SetOperationSummary(operation, $"Removes existing {rightName} from the {relationship} relationship of an individual {singularLeftName}."); + SetParameterDescription(operation.Parameters[0], $"The identifier of the {singularLeftName} to remove {rightName} from."); + SetRequestBodyDescription(operation.RequestBody, $"The identities of the {rightName} to remove from the {relationship} relationship."); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + $"The {rightName} were successfully removed, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextRequestBodyBad); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, $"The {singularLeftName} or a related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextConflict); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } + + private static RelationshipAttribute GetRelationshipFromRoute(ApiDescription apiDescription, ResourceType resourceType) + { + ConsistencyGuard.ThrowIf(apiDescription.RelativePath == null); + + string relationshipName = apiDescription.RelativePath.Split('/').Last(); + return resourceType.GetRelationshipByPublicName(relationshipName); + } + + private static void SetOperationSummary(OpenApiOperation operation, string description) + { + operation.Summary = XmlCommentsTextHelper.Humanize(description); + } + + private static void SetOperationRemarks(OpenApiOperation operation, string description) + { + operation.Description = XmlCommentsTextHelper.Humanize(description); + } + + private static void SetParameterDescription(OpenApiParameter parameter, string description) + { + parameter.Description = XmlCommentsTextHelper.Humanize(description); + } + + private static void SetRequestBodyDescription(OpenApiRequestBody requestBody, string description) + { + requestBody.Description = XmlCommentsTextHelper.Humanize(description); + } + + private static void SetResponseDescription(OpenApiResponses responses, HttpStatusCode statusCode, string description) + { + OpenApiResponse response = GetOrAddResponse(responses, statusCode); + response.Description = XmlCommentsTextHelper.Humanize(description); + } + + private static void SetResponseHeaderETag(OpenApiResponses responses, HttpStatusCode statusCode) + { + OpenApiResponse response = GetOrAddResponse(responses, statusCode); + + response.Headers[HeaderNames.ETag] = new OpenApiHeader + { + Description = "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + Required = true, + Schema = new OpenApiSchema + { + Type = "string" + } + }; + } + + private static void SetResponseHeaderContentLength(OpenApiResponses responses, HttpStatusCode statusCode) + { + OpenApiResponse response = GetOrAddResponse(responses, statusCode); + + response.Headers[HeaderNames.ContentLength] = new OpenApiHeader + { + Description = "Size of the HTTP response body, in bytes.", + Required = true, + Schema = new OpenApiSchema + { + Type = "integer", + Format = "int64" + } + }; + } + + private static void SetResponseHeaderLocation(OpenApiResponses responses, HttpStatusCode statusCode, string resourceName) + { + OpenApiResponse response = GetOrAddResponse(responses, statusCode); + + response.Headers[HeaderNames.Location] = new OpenApiHeader + { + Description = $"The URL at which the newly created {resourceName} can be retrieved.", + Required = true, + Schema = new OpenApiSchema + { + Type = "string", + Format = "uri" + } + }; + } + + private static OpenApiResponse GetOrAddResponse(OpenApiResponses responses, HttpStatusCode statusCode) + { + string responseCode = ((int)statusCode).ToString(); + + if (!responses.TryGetValue(responseCode, out OpenApiResponse? response)) + { + response = new OpenApiResponse(); + responses.Add(responseCode, response); + } + + return response; + } + + private static void AddQueryStringParameters(OpenApiOperation operation, bool isRelationshipEndpoint) + { + // The JSON:API query string parameters (include, filter, sort, page[size], page[number], fields[]) are too dynamic to represent in OpenAPI. + // - The parameter names for fields[] require exploding to all resource types, because outcome of possible resource types depends on + // the relationship chains in include, which are provided at invocation time. + // - The parameter names for filter/sort take a relationship path, which could be infinite. For example: ?filter[node.parent.parent.parent...]=... + + // The next best thing is to expose the query string parameters as unstructured and optional. + // - This makes SwaggerUI ask for JSON, which is a bit odd, but it works. For example: {"sort":"-id"} produces: ?sort=-id + // - This makes NSwag produce a C# client with method signature: GetAsync(IDictionary? query) + // when combined with true in the project file. + + operation.Parameters.Add(new OpenApiParameter + { + In = ParameterLocation.Query, + Name = "query", + Schema = new OpenApiSchema + { + Type = "object", + AdditionalProperties = new OpenApiSchema + { + Type = "string", + Nullable = true + }, + // Prevent SwaggerUI from producing sample, which fails when used because unknown query string parameters are blocked by default. + Example = new OpenApiString(string.Empty) + }, + Description = isRelationshipEndpoint ? RelationshipQueryStringParameters : ResourceQueryStringParameters + }); + } + + private static void AddRequestHeaderIfNoneMatch(OpenApiOperation operation) + { + operation.Parameters.Add(new OpenApiParameter + { + In = ParameterLocation.Header, + Name = "If-None-Match", + Description = "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + Schema = new OpenApiSchema + { + Type = "string" + } + }); + } + + private static void ApplyPostOperations(OpenApiOperation operation) + { + SetOperationSummary(operation, "Performs multiple mutations in a linear and atomic manner."); + + SetRequestBodyDescription(operation.RequestBody, + "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/)."); + + SetResponseDescription(operation.Responses, HttpStatusCode.OK, "All operations were successfully applied, which resulted in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.NoContent, + "All operations were successfully applied, which did not result in additional changes."); + + SetResponseDescription(operation.Responses, HttpStatusCode.BadRequest, TextRequestBodyBad); + SetResponseDescription(operation.Responses, HttpStatusCode.Forbidden, "An operation is not accessible or a client-generated ID is used."); + SetResponseDescription(operation.Responses, HttpStatusCode.NotFound, "A resource or a related resource does not exist."); + SetResponseDescription(operation.Responses, HttpStatusCode.Conflict, TextConflict); + SetResponseDescription(operation.Responses, HttpStatusCode.UnprocessableEntity, TextRequestBodyValidationFailed); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/EndpointOrderingFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/EndpointOrderingFilter.cs new file mode 100644 index 0000000000..047ba4355a --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/EndpointOrderingFilter.cs @@ -0,0 +1,46 @@ +using System.Text.RegularExpressions; +using JetBrains.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed partial class EndpointOrderingFilter : IDocumentFilter +{ + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + ArgumentNullException.ThrowIfNull(swaggerDoc); + ArgumentNullException.ThrowIfNull(context); + + KeyValuePair[] endpointsInOrder = swaggerDoc.Paths.OrderBy(GetPrimaryResourcePublicName) + .ThenBy(GetRelationshipName).ThenBy(IsSecondaryEndpoint).ToArray(); + + swaggerDoc.Paths.Clear(); + + foreach ((string url, OpenApiPathItem path) in endpointsInOrder) + { + swaggerDoc.Paths.Add(url, path); + } + } + + private static string GetPrimaryResourcePublicName(KeyValuePair entry) + { + return entry.Value.Operations.First().Value.Tags.First().Name; + } + + private static bool IsSecondaryEndpoint(KeyValuePair entry) + { + return entry.Key.Contains("/relationships"); + } + + private static string GetRelationshipName(KeyValuePair entry) + { + Match match = RelationshipNameInUrlRegex().Match(entry.Key); + + return match.Success ? match.Groups["RelationshipName"].Value : string.Empty; + } + + [GeneratedRegex(@".*{id}/(?>relationships\/)?(?\w+)", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture)] + private static partial Regex RelationshipNameInUrlRegex(); +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs new file mode 100644 index 0000000000..dcc652c696 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/JsonApiDataContractResolver.cs @@ -0,0 +1,99 @@ +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +/// +/// For schema generation, we rely on from Swashbuckle for all but our own JSON:API types. +/// +internal sealed class JsonApiDataContractResolver : ISerializerDataContractResolver +{ + private readonly IResourceGraph _resourceGraph; + private readonly JsonSerializerDataContractResolver _dataContractResolver; + + public JsonApiDataContractResolver(IJsonApiOptions options, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(options); + ArgumentNullException.ThrowIfNull(resourceGraph); + + _resourceGraph = resourceGraph; + _dataContractResolver = new JsonSerializerDataContractResolver(options.SerializerOptions); + } + + public DataContract GetDataContractForType(Type type) + { + ArgumentNullException.ThrowIfNull(type); + + if (type == typeof(IIdentifiable)) + { + // We have no way of telling Swashbuckle to opt out on this type, the closest we can get is return a contract with type Unknown. + return DataContract.ForDynamic(typeof(object)); + } + + DataContract dataContract = _dataContractResolver.GetDataContractForType(type); + + IList? replacementProperties = null; + + if (type.IsAssignableTo(typeof(IIdentifiable))) + { + replacementProperties = GetDataPropertiesThatExistInResourceClrType(type, dataContract); + } + + if (replacementProperties != null) + { + dataContract = ReplacePropertiesInDataContract(dataContract, replacementProperties); + } + + return dataContract; + } + + private static DataContract ReplacePropertiesInDataContract(DataContract dataContract, IEnumerable dataProperties) + { + return DataContract.ForObject(dataContract.UnderlyingType, dataProperties, dataContract.ObjectExtensionDataType, dataContract.ObjectTypeNameProperty, + dataContract.ObjectTypeNameValue); + } + + private List GetDataPropertiesThatExistInResourceClrType(Type resourceClrType, DataContract dataContract) + { + ResourceType resourceType = _resourceGraph.GetResourceType(resourceClrType); + List dataProperties = []; + + foreach (DataProperty property in dataContract.ObjectProperties) + { + if (property.MemberInfo.Name == nameof(Identifiable.Id)) + { + // Schemas of JsonApiDotNetCore resources will obtain an Id property through inheritance of a resource identifier type. + continue; + } + + ResourceFieldAttribute? matchingField = resourceType.Fields.SingleOrDefault(field => + IsPropertyCompatibleWithMember(field.Property, property.MemberInfo)); + + if (matchingField != null) + { + DataProperty matchingProperty = matchingField.PublicName != property.Name + ? ChangeDataPropertyName(property, matchingField.PublicName) + : property; + + dataProperties.Add(matchingProperty); + } + } + + return dataProperties; + } + + private static DataProperty ChangeDataPropertyName(DataProperty property, string name) + { + return new DataProperty(name, property.MemberType, property.IsRequired, property.IsNullable, property.IsReadOnly, property.IsWriteOnly, + property.MemberInfo); + } + + private static bool IsPropertyCompatibleWithMember(PropertyInfo property, MemberInfo member) + { + // In JsonApiDotNetCore the PropertyInfo for Id stored in AttrAttribute is that of the ReflectedType, whereas Newtonsoft uses the DeclaringType. + return property == member || property.DeclaringType?.GetProperty(property.Name) == member; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceDocumentationReader.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceDocumentationReader.cs new file mode 100644 index 0000000000..cd2727854c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceDocumentationReader.cs @@ -0,0 +1,89 @@ +using System.Collections.Concurrent; +using System.Reflection; +using System.Xml; +using System.Xml.XPath; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +internal sealed class ResourceDocumentationReader +{ + private static readonly ConcurrentDictionary NavigatorsByAssemblyPath = new(); + + public string? GetDocumentationForType(ResourceType resourceType) + { + ArgumentNullException.ThrowIfNull(resourceType); + + XPathNavigator? navigator = GetNavigator(resourceType.ClrType.Assembly); + + if (navigator != null) + { + string typeMemberName = XmlCommentsNodeNameHelper.GetMemberNameForType(resourceType.ClrType); + return GetSummary(navigator, typeMemberName); + } + + return null; + } + + public string? GetDocumentationForAttribute(AttrAttribute attribute) + { + ArgumentNullException.ThrowIfNull(attribute); + + XPathNavigator? navigator = GetNavigator(attribute.Type.ClrType.Assembly); + + if (navigator != null) + { + string propertyMemberName = XmlCommentsNodeNameHelper.GetMemberNameForFieldOrProperty(attribute.Property); + return GetSummary(navigator, propertyMemberName); + } + + return null; + } + + public string? GetDocumentationForRelationship(RelationshipAttribute relationship) + { + ArgumentNullException.ThrowIfNull(relationship); + + XPathNavigator? navigator = GetNavigator(relationship.Type.ClrType.Assembly); + + if (navigator != null) + { + string propertyMemberName = XmlCommentsNodeNameHelper.GetMemberNameForFieldOrProperty(relationship.Property); + return GetSummary(navigator, propertyMemberName); + } + + return null; + } + + private static XPathNavigator? GetNavigator(Assembly assembly) + { + string assemblyPath = assembly.Location; + + if (!string.IsNullOrEmpty(assemblyPath)) + { + return NavigatorsByAssemblyPath.GetOrAdd(assemblyPath, path => + { + string documentationPath = Path.ChangeExtension(path, ".xml"); + + if (File.Exists(documentationPath)) + { + using var reader = XmlReader.Create(documentationPath); + var document = new XPathDocument(reader); + return document.CreateNavigator(); + } + + return null; + }); + } + + return null; + } + + private string? GetSummary(XPathNavigator navigator, string memberName) + { + XPathNavigator? summaryNode = navigator.SelectSingleNode($"/doc/members/member[@name='{memberName}']/summary"); + return summaryNode != null ? XmlCommentsTextHelper.Humanize(summaryNode.InnerXml) : null; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs new file mode 100644 index 0000000000..31bf7be625 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceFieldSchemaBuilder.cs @@ -0,0 +1,250 @@ +using System.Reflection; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Components; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +internal sealed class ResourceFieldSchemaBuilder +{ + private readonly SchemaGenerationTracer _schemaGenerationTracer; + private readonly SchemaGenerator _defaultSchemaGenerator; + private readonly DataSchemaGenerator _dataSchemaGenerator; + private readonly LinksVisibilitySchemaGenerator _linksVisibilitySchemaGenerator; + private readonly ResourceSchemaType _resourceSchemaType; + private readonly ResourceFieldValidationMetadataProvider _resourceFieldValidationMetadataProvider; + private readonly RelationshipTypeFactory _relationshipTypeFactory; + + private readonly SchemaRepository _resourceSchemaRepository = new(); + private readonly ResourceDocumentationReader _resourceDocumentationReader = new(); + private readonly IDictionary _schemasForResourceFields; + + public ResourceFieldSchemaBuilder(SchemaGenerationTracer schemaGenerationTracer, SchemaGenerator defaultSchemaGenerator, + DataSchemaGenerator dataSchemaGenerator, LinksVisibilitySchemaGenerator linksVisibilitySchemaGenerator, + ResourceFieldValidationMetadataProvider resourceFieldValidationMetadataProvider, RelationshipTypeFactory relationshipTypeFactory, + ResourceSchemaType resourceSchemaType) + { + ArgumentNullException.ThrowIfNull(schemaGenerationTracer); + ArgumentNullException.ThrowIfNull(defaultSchemaGenerator); + ArgumentNullException.ThrowIfNull(dataSchemaGenerator); + ArgumentNullException.ThrowIfNull(linksVisibilitySchemaGenerator); + ArgumentNullException.ThrowIfNull(resourceSchemaType); + ArgumentNullException.ThrowIfNull(resourceFieldValidationMetadataProvider); + ArgumentNullException.ThrowIfNull(relationshipTypeFactory); + + _schemaGenerationTracer = schemaGenerationTracer; + _defaultSchemaGenerator = defaultSchemaGenerator; + _dataSchemaGenerator = dataSchemaGenerator; + _linksVisibilitySchemaGenerator = linksVisibilitySchemaGenerator; + _resourceSchemaType = resourceSchemaType; + _resourceFieldValidationMetadataProvider = resourceFieldValidationMetadataProvider; + _relationshipTypeFactory = relationshipTypeFactory; + + _schemasForResourceFields = GetFieldSchemas(); + } + + private IDictionary GetFieldSchemas() + { + if (!_resourceSchemaRepository.TryLookupByType(_resourceSchemaType.ResourceType.ClrType, out OpenApiSchema referenceSchemaForResource)) + { + referenceSchemaForResource = _defaultSchemaGenerator.GenerateSchema(_resourceSchemaType.ResourceType.ClrType, _resourceSchemaRepository); + } + + OpenApiSchema inlineSchemaForResource = _resourceSchemaRepository.Schemas[referenceSchemaForResource.Reference.Id].UnwrapLastExtendedSchema(); + return inlineSchemaForResource.Properties; + } + + public void SetMembersOfAttributes(OpenApiSchema fullSchemaForAttributes, bool forRequestSchema, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(fullSchemaForAttributes); + ArgumentNullException.ThrowIfNull(schemaRepository); + AssertHasNoProperties(fullSchemaForAttributes); + + AttrCapabilities requiredCapability = GetRequiredCapabilityForAttributes(_resourceSchemaType.SchemaOpenType); + + foreach ((string publicName, OpenApiSchema schemaForResourceField) in _schemasForResourceFields) + { + AttrAttribute? matchingAttribute = _resourceSchemaType.ResourceType.FindAttributeByPublicName(publicName); + + if (matchingAttribute != null && matchingAttribute.Capabilities.HasFlag(requiredCapability)) + { + if (forRequestSchema) + { + if (matchingAttribute.Property.SetMethod == null) + { + continue; + } + } + else + { + if (matchingAttribute.Property.GetMethod == null) + { + continue; + } + } + + bool isInlineSchemaType = schemaForResourceField.AllOf.Count == 0; + + // Schemas for types like enum and complex attributes are handled as reference schemas. + if (!isInlineSchemaType) + { + OpenApiSchema referenceSchemaForAttribute = schemaForResourceField.UnwrapLastExtendedSchema(); + EnsureAttributeSchemaIsExposed(referenceSchemaForAttribute, matchingAttribute, schemaRepository); + } + + fullSchemaForAttributes.Properties.Add(matchingAttribute.PublicName, schemaForResourceField); + + schemaForResourceField.Nullable = _resourceFieldValidationMetadataProvider.IsNullable(matchingAttribute); + + if (IsFieldRequired(matchingAttribute)) + { + fullSchemaForAttributes.Required.Add(matchingAttribute.PublicName); + } + + schemaForResourceField.Description = _resourceDocumentationReader.GetDocumentationForAttribute(matchingAttribute); + } + } + } + + private static AttrCapabilities GetRequiredCapabilityForAttributes(Type resourceDataOpenType) + { + AttrCapabilities? capabilities = null; + + if (resourceDataOpenType == typeof(DataInResponse<>)) + { + capabilities = AttrCapabilities.AllowView; + } + else if (resourceDataOpenType == typeof(DataInCreateRequest<>)) + { + capabilities = AttrCapabilities.AllowCreate; + } + else if (resourceDataOpenType == typeof(DataInUpdateRequest<>)) + { + capabilities = AttrCapabilities.AllowChange; + } + + ConsistencyGuard.ThrowIf(capabilities == null); + return capabilities.Value; + } + + private void EnsureAttributeSchemaIsExposed(OpenApiSchema referenceSchemaForAttribute, AttrAttribute attribute, SchemaRepository schemaRepository) + { + Type nonNullableTypeInPropertyType = GetRepresentedTypeForAttributeSchema(attribute); + + if (schemaRepository.TryLookupByType(nonNullableTypeInPropertyType, out _)) + { + return; + } + + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, nonNullableTypeInPropertyType); + + string schemaId = referenceSchemaForAttribute.Reference.Id; + OpenApiSchema fullSchema = _resourceSchemaRepository.Schemas[schemaId]; + + schemaRepository.AddDefinition(schemaId, fullSchema); + schemaRepository.RegisterType(nonNullableTypeInPropertyType, schemaId); + + traceScope.TraceSucceeded(schemaId); + } + + private Type GetRepresentedTypeForAttributeSchema(AttrAttribute attribute) + { + NullabilityInfoContext nullabilityInfoContext = new(); + NullabilityInfo attributeNullabilityInfo = nullabilityInfoContext.Create(attribute.Property); + + bool isNullable = attributeNullabilityInfo is { ReadState: NullabilityState.Nullable, WriteState: NullabilityState.Nullable }; + + Type nonNullableTypeInPropertyType = isNullable + ? Nullable.GetUnderlyingType(attribute.Property.PropertyType) ?? attribute.Property.PropertyType + : attribute.Property.PropertyType; + + return nonNullableTypeInPropertyType; + } + + private bool IsFieldRequired(ResourceFieldAttribute field) + { + bool isCreateResourceSchemaType = _resourceSchemaType.SchemaOpenType == typeof(DataInCreateRequest<>); + return isCreateResourceSchemaType && _resourceFieldValidationMetadataProvider.IsRequired(field); + } + + public void SetMembersOfRelationships(OpenApiSchema fullSchemaForRelationships, bool forRequestSchema, SchemaRepository schemaRepository) + { + ArgumentNullException.ThrowIfNull(fullSchemaForRelationships); + ArgumentNullException.ThrowIfNull(schemaRepository); + AssertHasNoProperties(fullSchemaForRelationships); + + foreach (string publicName in _schemasForResourceFields.Keys) + { + RelationshipAttribute? matchingRelationship = _resourceSchemaType.ResourceType.FindRelationshipByPublicName(publicName); + + if (matchingRelationship != null) + { + Type identifierSchemaOpenType = forRequestSchema ? typeof(IdentifierInRequest<>) : typeof(IdentifierInResponse<>); + Type identifierSchemaConstructedType = identifierSchemaOpenType.MakeGenericType(matchingRelationship.RightType.ClrType); + + _ = _dataSchemaGenerator.GenerateSchema(identifierSchemaConstructedType, forRequestSchema, schemaRepository); + AddRelationshipSchemaToResourceData(matchingRelationship, fullSchemaForRelationships, schemaRepository); + } + } + } + + private void AddRelationshipSchemaToResourceData(RelationshipAttribute relationship, OpenApiSchema fullSchemaForRelationships, + SchemaRepository schemaRepository) + { + Type relationshipSchemaType = GetRelationshipSchemaType(relationship, _resourceSchemaType.SchemaOpenType); + + OpenApiSchema referenceSchemaForRelationship = GetReferenceSchemaForRelationship(relationshipSchemaType, schemaRepository) ?? + CreateReferenceSchemaForRelationship(relationshipSchemaType, schemaRepository); + + OpenApiSchema extendedReferenceSchemaForRelationship = referenceSchemaForRelationship.WrapInExtendedSchema(); + extendedReferenceSchemaForRelationship.Description = _resourceDocumentationReader.GetDocumentationForRelationship(relationship); + + fullSchemaForRelationships.Properties.Add(relationship.PublicName, extendedReferenceSchemaForRelationship); + + if (IsFieldRequired(relationship)) + { + fullSchemaForRelationships.Required.Add(relationship.PublicName); + } + } + + private Type GetRelationshipSchemaType(RelationshipAttribute relationship, Type openSchemaType) + { + bool isResponseSchemaType = openSchemaType.IsAssignableTo(typeof(DataInResponse<>)); + return isResponseSchemaType ? _relationshipTypeFactory.GetForResponse(relationship) : _relationshipTypeFactory.GetForRequest(relationship); + } + + private OpenApiSchema? GetReferenceSchemaForRelationship(Type relationshipSchemaType, SchemaRepository schemaRepository) + { + return schemaRepository.TryLookupByType(relationshipSchemaType, out OpenApiSchema? referenceSchema) ? referenceSchema : null; + } + + private OpenApiSchema CreateReferenceSchemaForRelationship(Type relationshipSchemaType, SchemaRepository schemaRepository) + { + using ISchemaGenerationTraceScope traceScope = _schemaGenerationTracer.TraceStart(this, relationshipSchemaType); + + OpenApiSchema referenceSchema = _defaultSchemaGenerator.GenerateSchema(relationshipSchemaType, schemaRepository); + + OpenApiSchema fullSchema = schemaRepository.Schemas[referenceSchema.Reference.Id]; + + if (JsonApiSchemaFacts.HasNullableDataProperty(relationshipSchemaType)) + { + fullSchema.Properties[JsonApiPropertyName.Data].Nullable = true; + } + + if (JsonApiSchemaFacts.IsRelationshipInResponseType(relationshipSchemaType)) + { + _linksVisibilitySchemaGenerator.UpdateSchemaForRelationship(relationshipSchemaType, fullSchema, schemaRepository); + } + + traceScope.TraceSucceeded(referenceSchema.Reference.Id); + return referenceSchema; + } + + private static void AssertHasNoProperties(OpenApiSchema fullSchema) + { + ConsistencyGuard.ThrowIf(fullSchema.Properties.Count > 0); + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs new file mode 100644 index 0000000000..148f0f4e2c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ResourceSchemaType.cs @@ -0,0 +1,52 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.AtomicOperations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Documents; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.Relationships; +using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.ResourceObjects; +using JsonApiDotNetCore.Resources; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +/// +/// Represents a generic component schema type, whose first type parameter implements . Examples: +/// , , +/// , . +/// +internal sealed class ResourceSchemaType +{ + public Type SchemaConstructedType { get; } + public Type SchemaOpenType { get; } + public ResourceType ResourceType { get; } + + private ResourceSchemaType(Type schemaConstructedType, Type schemaOpenType, ResourceType resourceType) + { + SchemaConstructedType = schemaConstructedType; + SchemaOpenType = schemaOpenType; + ResourceType = resourceType; + } + + public static ResourceSchemaType Create(Type schemaConstructedType, IResourceGraph resourceGraph) + { + ArgumentNullException.ThrowIfNull(schemaConstructedType); + ArgumentNullException.ThrowIfNull(resourceGraph); + + Type schemaOpenType = schemaConstructedType.GetGenericTypeDefinition(); + Type resourceClrType = schemaConstructedType.GenericTypeArguments[0]; + ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); + + return new ResourceSchemaType(schemaConstructedType, schemaOpenType, resourceType); + } + + public ResourceSchemaType ChangeResourceType(ResourceType resourceType) + { + ArgumentNullException.ThrowIfNull(resourceType); + + Type schemaConstructedType = SchemaOpenType.MakeGenericType(resourceType.ClrType); + return new ResourceSchemaType(schemaConstructedType, SchemaOpenType, resourceType); + } + + public override string ToString() + { + return $"{SchemaOpenType.Name} for {ResourceType.ClrType.Name}"; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ServerDocumentFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ServerDocumentFilter.cs new file mode 100644 index 0000000000..723499d39c --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/ServerDocumentFilter.cs @@ -0,0 +1,32 @@ +using JetBrains.Annotations; +using Microsoft.AspNetCore.Http; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class ServerDocumentFilter : IDocumentFilter +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + public ServerDocumentFilter(IHttpContextAccessor httpContextAccessor) + { + ArgumentNullException.ThrowIfNull(httpContextAccessor); + + _httpContextAccessor = httpContextAccessor; + } + + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + if (swaggerDoc.Servers.Count == 0 && _httpContextAccessor.HttpContext != null) + { + HttpRequest httpRequest = _httpContextAccessor.HttpContext.Request; + + swaggerDoc.Servers.Add(new OpenApiServer + { + Url = $"{httpRequest.Scheme}://{httpRequest.Host.Value}" + }); + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs new file mode 100644 index 0000000000..dec10db97b --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/SwaggerComponents/StringEnumOrderingFilter.cs @@ -0,0 +1,54 @@ +using JetBrains.Annotations; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle.SwaggerComponents; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class StringEnumOrderingFilter : IDocumentFilter +{ + internal const string RequiresSortKey = "x-requires-sort"; + + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + ArgumentNullException.ThrowIfNull(document); + ArgumentNullException.ThrowIfNull(context); + + var visitor = new OpenApiEnumVisitor(); + var walker = new OpenApiWalker(visitor); + walker.Walk(document); + } + + private sealed class OpenApiEnumVisitor : OpenApiVisitorBase + { + public override void Visit(OpenApiSchema schema) + { + if (HasSortAnnotation(schema)) + { + if (schema.Enum.Count > 1) + { + OrderEnumMembers(schema); + } + } + + schema.Extensions.Remove(RequiresSortKey); + } + + private static bool HasSortAnnotation(OpenApiSchema schema) + { + // Order our own enums, but don't touch enums from user-defined resource attributes. + return schema.Extensions.TryGetValue(RequiresSortKey, out IOpenApiExtension? extension) && extension is OpenApiBoolean { Value: true }; + } + + private static void OrderEnumMembers(OpenApiSchema schema) + { + List ordered = schema.Enum.OfType().OrderBy(openApiString => openApiString.Value).Cast().ToList(); + ConsistencyGuard.ThrowIf(ordered.Count != schema.Enum.Count); + + schema.Enum = ordered; + } + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/TypeExtensions.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/TypeExtensions.cs new file mode 100644 index 0000000000..ebfb000577 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/TypeExtensions.cs @@ -0,0 +1,11 @@ +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +internal static class TypeExtensions +{ + public static Type ConstructedToOpenType(this Type type) + { + ArgumentNullException.ThrowIfNull(type); + + return type.IsConstructedGenericType ? type.GetGenericTypeDefinition() : type; + } +} diff --git a/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs new file mode 100644 index 0000000000..4e2addabb3 --- /dev/null +++ b/src/JsonApiDotNetCore.OpenApi.Swashbuckle/UnusedComponentSchemaCleaner.cs @@ -0,0 +1,185 @@ +using System.Diagnostics; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators; +using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace JsonApiDotNetCore.OpenApi.Swashbuckle; + +/// +/// Removes unreferenced component schemas from the OpenAPI document. +/// +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +internal sealed class UnusedComponentSchemaCleaner : IDocumentFilter +{ + private const string ComponentSchemaPrefix = "#/components/schemas/"; + + public void Apply(OpenApiDocument document, DocumentFilterContext context) + { + ArgumentNullException.ThrowIfNull(document); + ArgumentNullException.ThrowIfNull(context); + + document.Components.Schemas.Remove(GenerationCacheSchemaGenerator.SchemaId); + + HashSet unusedSchemaIds = GetUnusedSchemaIds(document); + AssertNoUnknownSchemasFound(unusedSchemaIds); + + RemoveUnusedComponentSchemas(document, unusedSchemaIds); + } + + private static HashSet GetUnusedSchemaIds(OpenApiDocument document) + { + HashSet reachableSchemaIds = ReachableRootsCollector.Instance.CollectReachableSchemaIds(document); + + ComponentSchemaUsageCollector collector = new(document); + return collector.CollectUnusedSchemaIds(reachableSchemaIds); + } + + [Conditional("DEBUG")] + private static void AssertNoUnknownSchemasFound(HashSet unusedSchemaIds) + { + if (unusedSchemaIds.Count > 0) + { + throw new InvalidOperationException($"Detected unused component schemas: {string.Join(", ", unusedSchemaIds)}"); + } + } + + private static void RemoveUnusedComponentSchemas(OpenApiDocument document, HashSet unusedSchemaIds) + { + foreach (string schemaId in unusedSchemaIds) + { + document.Components.Schemas.Remove(schemaId); + } + } + + private sealed class ReachableRootsCollector + { + public static ReachableRootsCollector Instance { get; } = new(); + + private ReachableRootsCollector() + { + } + + public HashSet CollectReachableSchemaIds(OpenApiDocument document) + { + ArgumentNullException.ThrowIfNull(document); + + var visitor = new ComponentSchemaReferenceVisitor(); + + var walker = new OpenApiWalker(visitor); + walker.Walk(document); + + return visitor.ReachableSchemaIds; + } + + private sealed class ComponentSchemaReferenceVisitor : OpenApiVisitorBase + { + public HashSet ReachableSchemaIds { get; } = []; + + public override void Visit(IOpenApiReferenceable referenceable) + { + if (!PathString.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) + { + if (referenceable is OpenApiSchema schema) + { + ReachableSchemaIds.Add(schema.Reference.Id); + } + } + } + } + } + + private sealed class ComponentSchemaUsageCollector + { + private readonly IDictionary _componentSchemas; + private readonly HashSet _schemaIdsInUse = []; + + public ComponentSchemaUsageCollector(OpenApiDocument document) + { + ArgumentNullException.ThrowIfNull(document); + + _componentSchemas = document.Components.Schemas; + } + + public HashSet CollectUnusedSchemaIds(ICollection reachableSchemaIds) + { + _schemaIdsInUse.Clear(); + + foreach (string schemaId in reachableSchemaIds) + { + WalkSchemaId(schemaId); + } + + HashSet unusedSchemaIds = _componentSchemas.Keys.ToHashSet(); + unusedSchemaIds.ExceptWith(_schemaIdsInUse); + return unusedSchemaIds; + } + + private void WalkSchemaId(string schemaId) + { + if (_schemaIdsInUse.Add(schemaId)) + { + if (_componentSchemas.TryGetValue(schemaId, out OpenApiSchema? schema)) + { + WalkSchema(schema); + } + } + } + + private void WalkSchema(OpenApiSchema? schema) + { + if (schema != null) + { + VisitSchema(schema); + + WalkSchema(schema.Items); + WalkSchema(schema.Not); + + foreach (OpenApiSchema? subSchema in schema.AllOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.AnyOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.OneOf) + { + WalkSchema(subSchema); + } + + foreach (OpenApiSchema? subSchema in schema.Properties.Values) + { + WalkSchema(subSchema); + } + + // ReSharper disable once TailRecursiveCall + WalkSchema(schema.AdditionalProperties); + } + } + + private void VisitSchema(OpenApiSchema schema) + { + if (schema.Reference is { Type: ReferenceType.Schema, IsExternal: false }) + { + WalkSchemaId(schema.Reference.Id); + } + + if (schema.Discriminator != null) + { + foreach (string mappingValue in schema.Discriminator.Mapping.Values) + { + if (mappingValue.StartsWith(ComponentSchemaPrefix, StringComparison.Ordinal)) + { + string schemaId = mappingValue[ComponentSchemaPrefix.Length..]; + WalkSchemaId(schemaId); + } + } + } + } + } +} diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj index 5e1c03f6b7..8f9e397df3 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj +++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj @@ -11,7 +11,6 @@ - $(JsonApiDotNetCoreVersionPrefix) jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api Source generators for JsonApiDotNetCore, a framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core. json-api-dotnet diff --git a/src/JsonApiDotNetCore/Configuration/ApplicationBuilderExtensions.cs b/src/JsonApiDotNetCore/Configuration/ApplicationBuilderExtensions.cs index 349cb20dd9..3957a28835 100644 --- a/src/JsonApiDotNetCore/Configuration/ApplicationBuilderExtensions.cs +++ b/src/JsonApiDotNetCore/Configuration/ApplicationBuilderExtensions.cs @@ -1,6 +1,7 @@ using JsonApiDotNetCore.Middleware; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; namespace JsonApiDotNetCore.Configuration; @@ -23,6 +24,7 @@ public static class ApplicationBuilderExtensions public static void UseJsonApi(this IApplicationBuilder builder) { ArgumentNullException.ThrowIfNull(builder); + AssertAspNetCoreOpenApiIsNotRegistered(builder.ApplicationServices); using (IServiceScope scope = builder.ApplicationServices.CreateScope()) { @@ -46,4 +48,33 @@ public static void UseJsonApi(this IApplicationBuilder builder) builder.UseMiddleware(); } + + private static void AssertAspNetCoreOpenApiIsNotRegistered(IServiceProvider serviceProvider) + { + Type? optionsType = TryLoadOptionsType(); + + if (optionsType != null) + { + Type configureType = typeof(IConfigureOptions<>).MakeGenericType(optionsType); + object? configureInstance = serviceProvider.GetService(configureType); + + if (configureInstance != null) + { + throw new InvalidOperationException("JsonApiDotNetCore is incompatible with ASP.NET OpenAPI. " + + "Replace 'services.AddOpenApi()' with 'services.AddOpenApiForJsonApi()' from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package."); + } + } + } + + private static Type? TryLoadOptionsType() + { + try + { + return Type.GetType("Microsoft.AspNetCore.OpenApi.OpenApiOptions, Microsoft.AspNetCore.OpenApi"); + } + catch (FileLoadException) + { + return null; + } + } } diff --git a/src/JsonApiDotNetCore/Diagnostics/CodeTimingSessionManager.cs b/src/JsonApiDotNetCore/Diagnostics/CodeTimingSessionManager.cs index 052784d0d6..adf642c3b8 100644 --- a/src/JsonApiDotNetCore/Diagnostics/CodeTimingSessionManager.cs +++ b/src/JsonApiDotNetCore/Diagnostics/CodeTimingSessionManager.cs @@ -31,7 +31,7 @@ public static ICodeTimer Current private static bool GetDefaultIsEnabled() { #if DEBUG - return !IsRunningInTest() && !IsRunningInBenchmark(); + return !IsRunningInTest() && !IsRunningInBenchmark() && !IsGeneratingOpenApiDocumentAtBuildTime(); #else return false; #endif @@ -52,6 +52,12 @@ private static bool IsRunningInBenchmark() return Assembly.GetEntryAssembly()?.GetName().Name == "Benchmarks"; } + // ReSharper disable once UnusedMember.Local + private static bool IsGeneratingOpenApiDocumentAtBuildTime() + { + return Environment.GetCommandLineArgs().Any(argument => argument.Contains("GetDocument.Insider")); + } + private static void AssertHasActiveSession() { if (_session == null) diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj index 91809e8903..1c1ba7ab7f 100644 --- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj +++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj @@ -8,7 +8,6 @@ - $(JsonApiDotNetCoreVersionPrefix) jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api A framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core. Includes support for Atomic Operations. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection making extensibility incredibly easy. json-api-dotnet diff --git a/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs b/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs index b8d6038508..051885a6bc 100644 --- a/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs +++ b/src/JsonApiDotNetCore/Properties/AssemblyInfo.cs @@ -2,5 +2,6 @@ [assembly: InternalsVisibleTo("Benchmarks")] [assembly: InternalsVisibleTo("DapperExample")] +[assembly: InternalsVisibleTo("JsonApiDotNetCore.OpenApi.Swashbuckle")] [assembly: InternalsVisibleTo("JsonApiDotNetCoreTests")] [assembly: InternalsVisibleTo("UnitTests")] diff --git a/src/JsonApiDotNetCore/Serialization/Objects/JsonApiObject.cs b/src/JsonApiDotNetCore/Serialization/Objects/JsonapiObject.cs similarity index 100% rename from src/JsonApiDotNetCore/Serialization/Objects/JsonApiObject.cs rename to src/JsonApiDotNetCore/Serialization/Objects/JsonapiObject.cs diff --git a/test/DiscoveryTests/AspNetOpenApiTests.cs b/test/DiscoveryTests/AspNetOpenApiTests.cs new file mode 100644 index 0000000000..20619f4cc1 --- /dev/null +++ b/test/DiscoveryTests/AspNetOpenApiTests.cs @@ -0,0 +1,31 @@ +#if !NET8_0 +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.TestHost; +using Microsoft.Extensions.DependencyInjection; +using Xunit; + +namespace DiscoveryTests; + +public sealed class AspNetOpenApiTests +{ + [Fact] + public async Task Throws_when_AspNet_OpenApi_is_registered() + { + // Arrange + WebApplicationBuilder builder = WebApplication.CreateEmptyBuilder(new WebApplicationOptions()); + builder.WebHost.UseTestServer(); + builder.Services.AddJsonApi(); + builder.Services.AddOpenApi(); + await using WebApplication app = builder.Build(); + + // Act + Action action = app.UseJsonApi; + + // Assert + action.Should().ThrowExactly().WithMessage("JsonApiDotNetCore is incompatible with ASP.NET OpenAPI. " + + "Replace 'services.AddOpenApi()' with 'services.AddOpenApiForJsonApi()' from the JsonApiDotNetCore.OpenApi.Swashbuckle NuGet package."); + } +} +#endif diff --git a/test/DiscoveryTests/DiscoveryTests.csproj b/test/DiscoveryTests/DiscoveryTests.csproj index abeaaa956d..825056684e 100644 --- a/test/DiscoveryTests/DiscoveryTests.csproj +++ b/test/DiscoveryTests/DiscoveryTests.csproj @@ -14,5 +14,6 @@ + diff --git a/test/OpenApiKiotaEndToEndTests/AdditionalPropertiesTests.cs b/test/OpenApiKiotaEndToEndTests/AdditionalPropertiesTests.cs new file mode 100644 index 0000000000..d3f8d75d43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AdditionalPropertiesTests.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using FluentAssertions; +using Xunit; + +namespace OpenApiKiotaEndToEndTests; + +public sealed class AdditionalPropertiesTests +{ + private static readonly string GeneratedCodeDirectory = $"{Path.DirectorySeparatorChar}GeneratedCode{Path.DirectorySeparatorChar}"; + + [Fact] + public async Task Additional_properties_are_only_allowed_in_meta() + { + string startDirectory = Path.GetFullPath(Path.Combine(Assembly.GetExecutingAssembly().Location, "../../../../")); + + foreach (string path in Directory.EnumerateFiles(startDirectory, "*.cs", new EnumerationOptions + { + MatchType = MatchType.Simple, + RecurseSubdirectories = true + })) + { + if (path.Contains(GeneratedCodeDirectory, StringComparison.OrdinalIgnoreCase) && + !string.Equals(Path.GetFileName(path), "Meta.cs", StringComparison.OrdinalIgnoreCase)) + { + string content = await File.ReadAllTextAsync(path); + bool containsAdditionalData = content.Contains("public IDictionary AdditionalData"); + + containsAdditionalData.Should().BeFalse($"file '{path}' should not contain AdditionalData"); + } + } + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs new file mode 100644 index 0000000000..0af2eff72c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs @@ -0,0 +1,214 @@ +using FluentAssertions; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.AtomicOperations; + +public sealed class AtomicCreateResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly OperationsFakers _fakers; + + public AtomicCreateResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_create_resource_with_attributes() + { + // Arrange + Teacher newTeacher = _fakers.Teacher.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateTeacherOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateTeacherRequest + { + Type = ResourceType.Teachers, + Attributes = new AttributesInCreateTeacherRequest + { + Name = newTeacher.Name, + EmailAddress = newTeacher.EmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(1); + DataInTeacherResponse teacherData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + + long newTeacherId = long.Parse(teacherData.Id!); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.FirstWithIdAsync(newTeacherId); + + teacherInDatabase.Name.Should().Be(newTeacher.Name); + teacherInDatabase.EmailAddress.Should().Be(newTeacher.EmailAddress); + }); + } + + [Fact] + public async Task Can_create_resource_with_attributes_and_relationships() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + Course existingCourse = _fakers.Course.GenerateOne(); + Enrollment newEnrollment = _fakers.Enrollment.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingStudent, existingCourse); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateEnrollmentOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateEnrollmentRequest + { + Type = ResourceType.Enrollments, + Attributes = new AttributesInCreateEnrollmentRequest + { + EnrolledAt = newEnrollment.EnrolledAt + }, + Relationships = new RelationshipsInCreateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId! + } + } + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(1); + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrollment.EnrolledAt); + enrollmentData.Attributes.GraduatedAt.Should().BeNull(); + enrollmentData.Attributes.HasGraduated.Should().BeFalse(); + + long newEnrollmentId = long.Parse(enrollmentData.Id!); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment enrollmentInDatabase = await dbContext.Enrollments.FirstWithIdAsync(newEnrollmentId); + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrollment.EnrolledAt); + enrollmentInDatabase.GraduatedAt.Should().BeNull(); + enrollmentInDatabase.HasGraduated.Should().BeFalse(); + }); + } + + [Fact] + public async Task Can_create_resource_with_client_generated_ID() + { + // Arrange + Course newCourse = _fakers.Course.GenerateOne(); + newCourse.Id = Guid.NewGuid(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateCourseOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateCourseRequest + { + Type = ResourceType.Courses, + Id = newCourse.Id, + Attributes = new AttributesInCreateCourseRequest + { + Subject = newCourse.Subject + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Course courseInDatabase = await dbContext.Courses.FirstWithIdAsync(newCourse.Id); + + courseInDatabase.Subject.Should().Be(newCourse.Subject); + courseInDatabase.Description.Should().BeNull(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs new file mode 100644 index 0000000000..3793fc2615 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs @@ -0,0 +1,81 @@ +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.AtomicOperations; + +public sealed class AtomicDeleteResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly OperationsFakers _fakers; + + public AtomicDeleteResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_delete_resource() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Enrollments.Add(existingEnrollment); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new DeleteEnrollmentOperation + { + Op = RemoveOperationCode.Remove, + Ref = new EnrollmentIdentifierInRequest + { + Type = ResourceType.Enrollments, + Id = existingEnrollment.StringId! + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment? enrollmentInDatabase = await dbContext.Enrollments.FirstWithIdOrDefaultAsync(existingEnrollment.Id); + + enrollmentInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs new file mode 100644 index 0000000000..cd44911339 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs @@ -0,0 +1,239 @@ +using FluentAssertions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.AtomicOperations; + +public sealed class AtomicLocalIdTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly OperationsFakers _fakers; + + public AtomicLocalIdTests(IntegrationTestContext, OperationsDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_use_local_IDs() + { + // Arrange + Teacher newTeacher = _fakers.Teacher.GenerateOne(); + Course newCourse = _fakers.Course.GenerateOne(); + newCourse.Id = Guid.NewGuid(); + Student newStudent = _fakers.Student.GenerateOne(); + DateOnly newEnrolledAt = _fakers.Enrollment.GenerateOne().EnrolledAt; + + const string teacherLocalId = "teacher-1"; + const string studentLocalId = "student-1"; + const string enrollmentLocalId = "enrollment-1"; + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateTeacherOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateTeacherRequest + { + Type = ResourceType.Teachers, + Lid = teacherLocalId, + Attributes = new AttributesInCreateTeacherRequest + { + Name = newTeacher.Name, + EmailAddress = newTeacher.EmailAddress + } + } + }, + new CreateCourseOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateCourseRequest + { + Type = ResourceType.Courses, + Id = newCourse.Id, + Attributes = new AttributesInCreateCourseRequest + { + Subject = newCourse.Subject, + Description = newCourse.Description + } + } + }, + new AddToTeacherTeachesRelationshipOperation + { + Op = AddOperationCode.Add, + Ref = new TeacherTeachesRelationshipIdentifier + { + Type = TeacherResourceType.Teachers, + Lid = teacherLocalId, + Relationship = TeacherTeachesRelationshipName.Teaches + }, + Data = + [ + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = newCourse.Id + } + ] + }, + new CreateStudentOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateStudentRequest + { + Type = ResourceType.Students, + Lid = studentLocalId, + Attributes = new AttributesInCreateStudentRequest + { + Name = newStudent.Name, + EmailAddress = newStudent.EmailAddress + } + } + }, + new CreateEnrollmentOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateEnrollmentRequest + { + Type = ResourceType.Enrollments, + Lid = enrollmentLocalId, + Attributes = new AttributesInCreateEnrollmentRequest + { + EnrolledAt = newEnrolledAt + }, + Relationships = new RelationshipsInCreateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = newCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Type = ResourceType.Students, + Lid = studentLocalId + } + } + } + } + }, + new UpdateStudentMentorRelationshipOperation + { + Op = UpdateOperationCode.Update, + Ref = new StudentMentorRelationshipIdentifier + { + Type = StudentResourceType.Students, + Lid = studentLocalId, + Relationship = StudentMentorRelationshipName.Mentor + }, + Data = new TeacherIdentifierInRequest + { + Type = ResourceType.Teachers, + Lid = teacherLocalId + } + }, + new DeleteTeacherOperation + { + Op = RemoveOperationCode.Remove, + Ref = new TeacherIdentifierInRequest + { + Type = ResourceType.Teachers, + Lid = teacherLocalId + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(7); + + DataInTeacherResponse teacherData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + long newTeacherId = long.Parse(teacherData.Id!); + + response.AtomicResults.ElementAt(1).Data.Should().BeNull(); + response.AtomicResults.ElementAt(2).Data.Should().BeNull(); + + DataInStudentResponse studentData = response.AtomicResults.ElementAt(3).Data.Should().BeOfType().Which; + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); + long newStudentId = long.Parse(studentData.Id!); + + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(4).Data.Should().BeOfType().Which; + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); + long newEnrollmentId = long.Parse(enrollmentData.Id!); + + response.AtomicResults.ElementAt(5).Data.Should().BeNull(); + response.AtomicResults.ElementAt(6).Data.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher? teacherInDatabase = await dbContext.Teachers.FirstWithIdOrDefaultAsync(newTeacherId); + teacherInDatabase.Should().BeNull(); + + Course courseInDatabase = await dbContext.Courses.Include(course => course.TaughtBy).FirstWithIdAsync(newCourse.Id); + courseInDatabase.Subject.Should().Be(newCourse.Subject); + courseInDatabase.Description.Should().Be(newCourse.Description); + courseInDatabase.TaughtBy.Should().BeEmpty(); + + Student studentInDatabase = await dbContext.Students.Include(student => student.Mentor).FirstWithIdAsync(newStudentId); + studentInDatabase.Name.Should().Be(newStudent.Name); + studentInDatabase.EmailAddress.Should().Be(newStudent.EmailAddress); + studentInDatabase.Mentor.Should().BeNull(); + + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + Enrollment enrollmentInDatabase = await dbContext.Enrollments + .Include(enrollment => enrollment.Course) + .Include(enrollment => enrollment.Student) + .FirstWithIdAsync(newEnrollmentId); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrolledAt); + enrollmentInDatabase.Course.Should().NotBeNull(); + enrollmentInDatabase.Course.Id.Should().Be(newCourse.Id); + enrollmentInDatabase.Student.Id.Should().Be(newStudentId); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs new file mode 100644 index 0000000000..c07c688252 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs @@ -0,0 +1,281 @@ +using FluentAssertions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.AtomicOperations; + +public sealed class AtomicRelationshipTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly OperationsFakers _fakers; + + public AtomicRelationshipTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_update_ToOne_relationship() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + Student existingStudent = _fakers.Student.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingEnrollment, existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new UpdateEnrollmentStudentRelationshipOperation + { + Op = UpdateOperationCode.Update, + Ref = new EnrollmentStudentRelationshipIdentifier + { + Type = EnrollmentResourceType.Enrollments, + Id = existingEnrollment.StringId!, + Relationship = EnrollmentStudentRelationshipName.Student + }, + Data = new StudentIdentifierInRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId! + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment enrollmentInDatabase = await dbContext.Enrollments.Include(enrollment => enrollment.Student).FirstWithIdAsync(existingEnrollment.Id); + + enrollmentInDatabase.Student.Should().NotBeNull(); + enrollmentInDatabase.Student.Id.Should().Be(existingStudent.Id); + }); + } + + [Fact] + public async Task Can_update_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(1); + List existingCourses = _fakers.Course.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + dbContext.AddRange(existingCourses); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new UpdateTeacherTeachesRelationshipOperation + { + Op = UpdateOperationCode.Update, + Ref = new TeacherTeachesRelationshipIdentifier + { + Id = existingTeacher.StringId!, + Type = TeacherResourceType.Teachers, + Relationship = TeacherTeachesRelationshipName.Teaches + }, + Data = + [ + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourses.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourses.ElementAt(1).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(2); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(1).Id); + }); + } + + [Fact] + public async Task Can_add_to_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(1); + List existingCourses = _fakers.Course.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + dbContext.AddRange(existingCourses); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new AddToTeacherTeachesRelationshipOperation + { + Op = AddOperationCode.Add, + Ref = new TeacherTeachesRelationshipIdentifier + { + Type = TeacherResourceType.Teachers, + Id = existingTeacher.StringId!, + Relationship = TeacherTeachesRelationshipName.Teaches + }, + Data = + [ + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourses.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourses.ElementAt(1).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(3); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingTeacher.Teaches.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(1).Id); + }); + } + + [Fact] + public async Task Can_remove_from_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new RemoveFromTeacherTeachesRelationshipOperation + { + Op = RemoveOperationCode.Remove, + Ref = new TeacherTeachesRelationshipIdentifier + { + Type = TeacherResourceType.Teachers, + Id = existingTeacher.StringId!, + Relationship = TeacherTeachesRelationshipName.Teaches + }, + Data = + [ + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingTeacher.Teaches.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingTeacher.Teaches.ElementAt(2).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(1); + teacherInDatabase.Teaches.ElementAt(0).Id.Should().Be(existingTeacher.Teaches.ElementAt(1).Id); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs new file mode 100644 index 0000000000..c5aca4ec15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs @@ -0,0 +1,265 @@ +using FluentAssertions; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.AtomicOperations; + +public sealed class AtomicUpdateResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly OperationsFakers _fakers; + + public AtomicUpdateResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>))); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_update_resource_with_attributes() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + string newName = _fakers.Student.GenerateOne().Name; + string? newEmailAddress = _fakers.Student.GenerateOne().EmailAddress; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Students.Add(existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new UpdateStudentOperation + { + Op = UpdateOperationCode.Update, + Data = new DataInUpdateStudentRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId!, + Attributes = new AttributesInUpdateStudentRequest + { + Name = newName, + EmailAddress = newEmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(1); + DataInStudentResponse studentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newName); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Student studentInDatabase = await dbContext.Students.FirstWithIdAsync(existingStudent.Id); + + studentInDatabase.Name.Should().Be(newName); + studentInDatabase.EmailAddress.Should().Be(newEmailAddress); + }); + } + + [Fact] + public async Task Can_update_resource_with_attributes_using_ref() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + string? newEmailAddress = _fakers.Student.GenerateOne().EmailAddress; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Students.Add(existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new UpdateStudentOperation + { + Op = UpdateOperationCode.Update, + Ref = new StudentIdentifierInRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId! + }, + Data = new DataInUpdateStudentRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId!, + Attributes = new AttributesInUpdateStudentRequest + { + EmailAddress = newEmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(1); + DataInStudentResponse studentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(existingStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Student studentInDatabase = await dbContext.Students.FirstWithIdAsync(existingStudent.Id); + + studentInDatabase.Name.Should().Be(existingStudent.Name); + studentInDatabase.EmailAddress.Should().Be(newEmailAddress); + }); + } + + [Fact] + public async Task Can_update_resource_with_attributes_and_relationships() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + Student existingStudent = _fakers.Student.GenerateOne(); + Course existingCourse = _fakers.Course.GenerateOne(); + DateOnly newEnrolledAt = _fakers.Enrollment.GenerateOne().EnrolledAt; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingEnrollment, existingStudent, existingCourse); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new AtomicOperationsClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new UpdateEnrollmentOperation + { + Op = UpdateOperationCode.Update, + Data = new DataInUpdateEnrollmentRequest + { + Type = ResourceType.Enrollments, + Id = existingEnrollment.StringId!, + Attributes = new AttributesInUpdateEnrollmentRequest + { + EnrolledAt = newEnrolledAt + }, + Relationships = new RelationshipsInUpdateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Type = ResourceType.Courses, + Id = existingCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Type = ResourceType.Students, + Id = existingStudent.StringId! + } + } + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + response.AtomicResults.Should().HaveCount(1); + DataInEnrollmentResponse enrollmentData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Which; + + enrollmentData.Id.Should().Be(existingEnrollment.StringId); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be((Date)newEnrolledAt); + enrollmentData.Attributes.GraduatedAt.Should().Be((Date)existingEnrollment.GraduatedAt!.Value); + enrollmentData.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + Enrollment enrollmentInDatabase = await dbContext.Enrollments + .Include(enrollment => enrollment.Student) + .Include(enrollment => enrollment.Course) + .FirstWithIdAsync(existingEnrollment.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrolledAt); + enrollmentInDatabase.GraduatedAt.Should().Be(existingEnrollment.GraduatedAt); + enrollmentInDatabase.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + + enrollmentInDatabase.Student.Should().NotBeNull(); + enrollmentInDatabase.Student.Id.Should().Be(existingStudent.Id); + + enrollmentInDatabase.Course.Should().NotBeNull(); + enrollmentInDatabase.Course.Id.Should().Be(existingCourse.Id); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/AtomicOperationsClient.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/AtomicOperationsClient.cs new file mode 100644 index 0000000000..c55a40b9d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/AtomicOperationsClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AtomicOperationsClient : BaseRequestBuilder + { + /// The operations property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public AtomicOperationsClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddOperationCode.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddOperationCode.cs new file mode 100644 index 0000000000..b3cdfa02a1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum AddOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "add")] + #pragma warning disable CS1591 + Add, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseEnrollmentsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseEnrollmentsRelationshipOperation.cs new file mode 100644 index 0000000000..1a7bbf708b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseEnrollmentsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToCourseEnrollmentsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseEnrollmentsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseEnrollmentsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseTaughtByRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseTaughtByRelationshipOperation.cs new file mode 100644 index 0000000000..9826e2e5e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToCourseTaughtByRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToCourseTaughtByRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseTaughtByRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseTaughtByRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseTaughtByRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseTaughtByRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToStudentEnrollmentsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToStudentEnrollmentsRelationshipOperation.cs new file mode 100644 index 0000000000..4378cb260f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToStudentEnrollmentsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToStudentEnrollmentsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToStudentEnrollmentsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToStudentEnrollmentsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherMentorsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherMentorsRelationshipOperation.cs new file mode 100644 index 0000000000..d2365eb79e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherMentorsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToTeacherMentorsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherMentorsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherMentorsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherTeachesRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherTeachesRelationshipOperation.cs new file mode 100644 index 0000000000..052b93ccd2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AddToTeacherTeachesRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToTeacherTeachesRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherTeachesRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherTeachesRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..08b81af5ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,109 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addCourse" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateCourseOperation(), + "addEnrollment" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateEnrollmentOperation(), + "addStudent" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateStudentOperation(), + "addTeacher" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateTeacherOperation(), + "addToCourseEnrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseEnrollmentsRelationshipOperation(), + "addToCourseTaughtBy" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToCourseTaughtByRelationshipOperation(), + "addToStudentEnrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToStudentEnrollmentsRelationshipOperation(), + "addToTeacherMentors" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherMentorsRelationshipOperation(), + "addToTeacherTeaches" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddToTeacherTeachesRelationshipOperation(), + "removeCourse" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteCourseOperation(), + "removeEnrollment" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteEnrollmentOperation(), + "removeFromStudentEnrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromStudentEnrollmentsRelationshipOperation(), + "removeFromTeacherMentors" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherMentorsRelationshipOperation(), + "removeFromTeacherTeaches" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherTeachesRelationshipOperation(), + "removeTeacher" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteTeacherOperation(), + "updateCourse" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseOperation(), + "updateCourseEnrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseEnrollmentsRelationshipOperation(), + "updateEnrollment" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentOperation(), + "updateEnrollmentCourse" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentCourseRelationshipOperation(), + "updateEnrollmentStudent" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentStudentRelationshipOperation(), + "updateStudent" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentOperation(), + "updateStudentEnrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentEnrollmentsRelationshipOperation(), + "updateStudentMentor" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentMentorRelationshipOperation(), + "updateTeacher" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherOperation(), + "updateTeacherMentors" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherMentorsRelationshipOperation(), + "updateTeacherTeaches" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherTeachesRelationshipOperation(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..2904a10156 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs new file mode 100644 index 0000000000..df6e6c79e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCourseResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The subject property + public string? Subject + { + get { return BackingStore?.Get("subject"); } + set { BackingStore?.Set("subject", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "subject", n => { Subject = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteStringValue("subject", Subject); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs new file mode 100644 index 0000000000..ba7579971a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateCourseRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The subject property + public string? Subject + { + get { return BackingStore?.Get("subject"); } + set { BackingStore?.Set("subject", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "subject", n => { Subject = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteStringValue("subject", Subject); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs new file mode 100644 index 0000000000..40a8d42f00 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateEnrollmentRequest.cs @@ -0,0 +1,69 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrolledAt property + public Date? EnrolledAt + { + get { return BackingStore?.Get("enrolledAt"); } + set { BackingStore?.Set("enrolledAt", value); } + } + + /// The graduatedAt property + public Date? GraduatedAt + { + get { return BackingStore?.Get("graduatedAt"); } + set { BackingStore?.Set("graduatedAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, + { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateValue("enrolledAt", EnrolledAt); + writer.WriteDateValue("graduatedAt", GraduatedAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..637d585be2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs new file mode 100644 index 0000000000..fe38dd276a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateStudentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs new file mode 100644 index 0000000000..892163936d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInCreateTeacherRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs new file mode 100644 index 0000000000..d771e3c9ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInEnrollmentResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The enrolledAt property + public Date? EnrolledAt + { + get { return BackingStore?.Get("enrolledAt"); } + set { BackingStore?.Set("enrolledAt", value); } + } + + /// The graduatedAt property + public Date? GraduatedAt + { + get { return BackingStore?.Get("graduatedAt"); } + set { BackingStore?.Set("graduatedAt", value); } + } + + /// The hasGraduated property + public bool? HasGraduated + { + get { return BackingStore?.Get("hasGraduated"); } + set { BackingStore?.Set("hasGraduated", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, + { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, + { "hasGraduated", n => { HasGraduated = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateValue("enrolledAt", EnrolledAt); + writer.WriteDateValue("graduatedAt", GraduatedAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..b2fa62f1bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs new file mode 100644 index 0000000000..5246f61c11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInStudentResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs new file mode 100644 index 0000000000..be526f6a13 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInTeacherResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs new file mode 100644 index 0000000000..4424257f52 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateCourseRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The subject property + public string? Subject + { + get { return BackingStore?.Get("subject"); } + set { BackingStore?.Set("subject", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "subject", n => { Subject = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteStringValue("subject", Subject); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs new file mode 100644 index 0000000000..94c926c8a7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateEnrollmentRequest.cs @@ -0,0 +1,69 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrolledAt property + public Date? EnrolledAt + { + get { return BackingStore?.Get("enrolledAt"); } + set { BackingStore?.Set("enrolledAt", value); } + } + + /// The graduatedAt property + public Date? GraduatedAt + { + get { return BackingStore?.Get("graduatedAt"); } + set { BackingStore?.Set("graduatedAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrolledAt", n => { EnrolledAt = n.GetDateValue(); } }, + { "graduatedAt", n => { GraduatedAt = n.GetDateValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateValue("enrolledAt", EnrolledAt); + writer.WriteDateValue("graduatedAt", GraduatedAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..773a8e7ff4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs new file mode 100644 index 0000000000..6617a18ac0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateStudentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs new file mode 100644 index 0000000000..a06272523e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/AttributesInUpdateTeacherRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The emailAddress property + public string? EmailAddress + { + get { return BackingStore?.Get("emailAddress"); } + set { BackingStore?.Set("emailAddress", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "emailAddress", n => { EmailAddress = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("emailAddress", EmailAddress); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipIdentifier.cs new file mode 100644 index 0000000000..aec552813d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CourseEnrollmentsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CourseEnrollmentsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipName.cs new file mode 100644 index 0000000000..39d9635743 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseEnrollmentsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum CourseEnrollmentsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "enrollments")] + #pragma warning disable CS1591 + Enrollments, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs new file mode 100644 index 0000000000..1533147c0e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CourseIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs new file mode 100644 index 0000000000..10c23cdb90 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CourseIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CourseIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseResourceType.cs new file mode 100644 index 0000000000..718985799f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum CourseResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "courses")] + #pragma warning disable CS1591 + Courses, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipIdentifier.cs new file mode 100644 index 0000000000..62b9885b89 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CourseTaughtByRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseTaughtByRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CourseTaughtByRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseTaughtByRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseTaughtByRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipName.cs new file mode 100644 index 0000000000..a0492c5178 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CourseTaughtByRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum CourseTaughtByRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "taughtBy")] + #pragma warning disable CS1591 + TaughtBy, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseOperation.cs new file mode 100644 index 0000000000..8b91fafae9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateCourseOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateCourseOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateCourseOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateCourseOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentOperation.cs new file mode 100644 index 0000000000..c81925259d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateEnrollmentOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateEnrollmentOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateEnrollmentOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateEnrollmentOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentOperation.cs new file mode 100644 index 0000000000..5784567050 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateStudentOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateStudentOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateStudentOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateStudentOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherOperation.cs new file mode 100644 index 0000000000..2409823479 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/CreateTeacherOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTeacherOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateTeacherOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CreateTeacherOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs new file mode 100644 index 0000000000..88d5b209d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCourseResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCourseResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs new file mode 100644 index 0000000000..70c3e9b657 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateCourseRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateCourseRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs new file mode 100644 index 0000000000..2ed42a7b79 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateEnrollmentRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs new file mode 100644 index 0000000000..1dfe2e6f34 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateStudentRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateStudentRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs new file mode 100644 index 0000000000..401be5db98 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInCreateTeacherRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs new file mode 100644 index 0000000000..d975990b73 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInEnrollmentResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInEnrollmentResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs new file mode 100644 index 0000000000..b2f951287c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInStudentResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInStudentResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs new file mode 100644 index 0000000000..a18f14d2df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInTeacherResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInTeacherResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs new file mode 100644 index 0000000000..dac21081ee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateCourseRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs new file mode 100644 index 0000000000..ac1c9a49ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateEnrollmentRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs new file mode 100644 index 0000000000..14f92de1ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateStudentRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs new file mode 100644 index 0000000000..6e4c69ea87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DataInUpdateTeacherRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AttributesInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteCourseOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteCourseOperation.cs new file mode 100644 index 0000000000..25dbaeb0a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteCourseOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeleteCourseOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteCourseOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteCourseOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteEnrollmentOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteEnrollmentOperation.cs new file mode 100644 index 0000000000..9a7faec4ba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteEnrollmentOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeleteEnrollmentOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteEnrollmentOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteEnrollmentOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteTeacherOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteTeacherOperation.cs new file mode 100644 index 0000000000..d0dfa14fe8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/DeleteTeacherOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DeleteTeacherOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteTeacherOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DeleteTeacherOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipIdentifier.cs new file mode 100644 index 0000000000..8f812e0c87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class EnrollmentCourseRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentCourseRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public EnrollmentCourseRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentCourseRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentCourseRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipName.cs new file mode 100644 index 0000000000..66677b8bd7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentCourseRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum EnrollmentCourseRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "course")] + #pragma warning disable CS1591 + Course, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs new file mode 100644 index 0000000000..cf87ae7eaa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class EnrollmentIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs new file mode 100644 index 0000000000..8b11b4d6fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class EnrollmentIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public EnrollmentIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentResourceType.cs new file mode 100644 index 0000000000..35a458ed81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum EnrollmentResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "enrollments")] + #pragma warning disable CS1591 + Enrollments, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipIdentifier.cs new file mode 100644 index 0000000000..99fd722766 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class EnrollmentStudentRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentStudentRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public EnrollmentStudentRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentStudentRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentStudentRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipName.cs new file mode 100644 index 0000000000..d241bd62cb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/EnrollmentStudentRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum EnrollmentStudentRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "student")] + #pragma warning disable CS1591 + Student, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..272918934e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..7a14b36845 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..69b0fdeb9c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,101 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The jsonapi property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi? Jsonapi + { + get { return BackingStore?.Get("jsonapi"); } + set { BackingStore?.Set("jsonapi", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "jsonapi", n => { Jsonapi = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("jsonapi", Jsonapi); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..ab85081caa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..f870eba588 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..3c4820a647 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Jsonapi.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Jsonapi.cs new file mode 100644 index 0000000000..1c285062e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Jsonapi.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Jsonapi : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The ext property + public List? Ext + { + get { return BackingStore?.Get?>("ext"); } + set { BackingStore?.Set("ext", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The profile property + public List? Profile + { + get { return BackingStore?.Get?>("profile"); } + set { BackingStore?.Set("profile", value); } + } + + /// The version property + public string? Version + { + get { return BackingStore?.Get("version"); } + set { BackingStore?.Set("version", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public Jsonapi() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "ext", n => { Ext = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "profile", n => { Profile = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "version", n => { Version = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfPrimitiveValues("ext", Ext); + writer.WriteObjectValue("meta", Meta); + writer.WriteCollectionOfPrimitiveValues("profile", Profile); + writer.WriteStringValue("version", Version); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..4829eeb5a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs new file mode 100644 index 0000000000..3b65be2940 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneTeacherInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneTeacherInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInResponse.cs new file mode 100644 index 0000000000..ef6d9a9cdd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/NullableToOneTeacherInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneTeacherInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneTeacherInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..a61ba35865 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..a9b1eef86c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The jsonapi property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi? Jsonapi + { + get { return BackingStore?.Get("jsonapi"); } + set { BackingStore?.Set("jsonapi", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "jsonapi", n => { Jsonapi = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Jsonapi.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("jsonapi", Jsonapi); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..a0d2ce3d38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs new file mode 100644 index 0000000000..c379e758f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCourseResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCourseResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The taughtBy property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInResponse? TaughtBy + { + get { return BackingStore?.Get("taughtBy"); } + set { BackingStore?.Set("taughtBy", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse.CreateFromDiscriminatorValue); } }, + { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("taughtBy", TaughtBy); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs new file mode 100644 index 0000000000..3e359c582b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateCourseRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The taughtBy property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest? TaughtBy + { + get { return BackingStore?.Get("taughtBy"); } + set { BackingStore?.Set("taughtBy", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, + { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("taughtBy", TaughtBy); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs new file mode 100644 index 0000000000..fbbe4cd5fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateEnrollmentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The course property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest? Course + { + get { return BackingStore?.Get("course"); } + set { BackingStore?.Set("course", value); } + } + + /// The student property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest? Student + { + get { return BackingStore?.Get("student"); } + set { BackingStore?.Set("student", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest.CreateFromDiscriminatorValue); } }, + { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("course", Course); + writer.WriteObjectValue("student", Student); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..2495275ea0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs new file mode 100644 index 0000000000..ce58511fb7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateStudentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The mentor property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest? Mentor + { + get { return BackingStore?.Get("mentor"); } + set { BackingStore?.Set("mentor", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, + { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("mentor", Mentor); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs new file mode 100644 index 0000000000..4571924fb8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInCreateTeacherRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The mentors property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest? Mentors + { + get { return BackingStore?.Get("mentors"); } + set { BackingStore?.Set("mentors", value); } + } + + /// The teaches property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest? Teaches + { + get { return BackingStore?.Get("teaches"); } + set { BackingStore?.Set("teaches", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCreateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest.CreateFromDiscriminatorValue); } }, + { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("mentors", Mentors); + writer.WriteObjectValue("teaches", Teaches); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs new file mode 100644 index 0000000000..4de0b551e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInEnrollmentResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInEnrollmentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The course property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse? Course + { + get { return BackingStore?.Get("course"); } + set { BackingStore?.Set("course", value); } + } + + /// The student property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInResponse? Student + { + get { return BackingStore?.Get("student"); } + set { BackingStore?.Set("student", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse.CreateFromDiscriminatorValue); } }, + { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("course", Course); + writer.WriteObjectValue("student", Student); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..6902dedf96 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs new file mode 100644 index 0000000000..fe1560af47 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInStudentResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInStudentResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The mentor property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInResponse? Mentor + { + get { return BackingStore?.Get("mentor"); } + set { BackingStore?.Set("mentor", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInStudentResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse.CreateFromDiscriminatorValue); } }, + { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("mentor", Mentor); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs new file mode 100644 index 0000000000..aa2a9666db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInTeacherResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInTeacherResponse : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The mentors property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse? Mentors + { + get { return BackingStore?.Get("mentors"); } + set { BackingStore?.Set("mentors", value); } + } + + /// The teaches property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInResponse? Teaches + { + get { return BackingStore?.Get("teaches"); } + set { BackingStore?.Set("teaches", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInTeacherResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse.CreateFromDiscriminatorValue); } }, + { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("mentors", Mentors); + writer.WriteObjectValue("teaches", Teaches); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs new file mode 100644 index 0000000000..fcec16798b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateCourseRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateCourseRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The taughtBy property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest? TaughtBy + { + get { return BackingStore?.Get("taughtBy"); } + set { BackingStore?.Set("taughtBy", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, + { "taughtBy", n => { TaughtBy = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("taughtBy", TaughtBy); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs new file mode 100644 index 0000000000..4902edd159 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateEnrollmentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateEnrollmentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The course property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest? Course + { + get { return BackingStore?.Get("course"); } + set { BackingStore?.Set("course", value); } + } + + /// The student property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest? Student + { + get { return BackingStore?.Get("student"); } + set { BackingStore?.Set("student", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "course", n => { Course = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest.CreateFromDiscriminatorValue); } }, + { "student", n => { Student = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("course", Course); + writer.WriteObjectValue("student", Student); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..72224b3a16 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs new file mode 100644 index 0000000000..b2b4fde160 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateStudentRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateStudentRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The enrollments property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest? Enrollments + { + get { return BackingStore?.Get("enrollments"); } + set { BackingStore?.Set("enrollments", value); } + } + + /// The mentor property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest? Mentor + { + get { return BackingStore?.Get("mentor"); } + set { BackingStore?.Set("mentor", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateStudentRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "enrollments", n => { Enrollments = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest.CreateFromDiscriminatorValue); } }, + { "mentor", n => { Mentor = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.NullableToOneTeacherInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("enrollments", Enrollments); + writer.WriteObjectValue("mentor", Mentor); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs new file mode 100644 index 0000000000..a2e503c4ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RelationshipsInUpdateTeacherRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateTeacherRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The mentors property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest? Mentors + { + get { return BackingStore?.Get("mentors"); } + set { BackingStore?.Set("mentors", value); } + } + + /// The teaches property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest? Teaches + { + get { return BackingStore?.Get("teaches"); } + set { BackingStore?.Set("teaches", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipsInUpdateTeacherRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "mentors", n => { Mentors = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest.CreateFromDiscriminatorValue); } }, + { "teaches", n => { Teaches = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("mentors", Mentors); + writer.WriteObjectValue("teaches", Teaches); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromStudentEnrollmentsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromStudentEnrollmentsRelationshipOperation.cs new file mode 100644 index 0000000000..b4f14e619f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromStudentEnrollmentsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromStudentEnrollmentsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromStudentEnrollmentsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromStudentEnrollmentsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherMentorsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherMentorsRelationshipOperation.cs new file mode 100644 index 0000000000..0d866c35ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherMentorsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromTeacherMentorsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherMentorsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherMentorsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherTeachesRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherTeachesRelationshipOperation.cs new file mode 100644 index 0000000000..7f645cf583 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveFromTeacherTeachesRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromTeacherTeachesRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherTeachesRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RemoveFromTeacherTeachesRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveOperationCode.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..adce14d4ce --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..5ac8dbd672 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCreateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..770c825f12 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInCourseResponse(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInEnrollmentResponse(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInStudentResponse(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInTeacherResponse(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..bf38a35f4c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "courses" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest(), + "enrollments" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest(), + "students" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest(), + "teachers" => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest(), + _ => new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..4aead01fdf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..c3ed8dfdb3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..f1b11f5e63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,30 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "courses")] + #pragma warning disable CS1591 + Courses, + #pragma warning restore CS1591 + [EnumMember(Value = "enrollments")] + #pragma warning disable CS1591 + Enrollments, + #pragma warning restore CS1591 + [EnumMember(Value = "students")] + #pragma warning disable CS1591 + Students, + #pragma warning restore CS1591 + [EnumMember(Value = "teachers")] + #pragma warning disable CS1591 + Teachers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipIdentifier.cs new file mode 100644 index 0000000000..823b2baf07 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StudentEnrollmentsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StudentEnrollmentsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipName.cs new file mode 100644 index 0000000000..7ee5616951 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentEnrollmentsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StudentEnrollmentsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "enrollments")] + #pragma warning disable CS1591 + Enrollments, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs new file mode 100644 index 0000000000..ca44dd2749 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StudentIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs new file mode 100644 index 0000000000..be1224ea4d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StudentIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StudentIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipIdentifier.cs new file mode 100644 index 0000000000..914e2f3eed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StudentMentorRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentMentorRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StudentMentorRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentMentorRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentMentorRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipName.cs new file mode 100644 index 0000000000..d944176dab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentMentorRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StudentMentorRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "mentor")] + #pragma warning disable CS1591 + Mentor, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentResourceType.cs new file mode 100644 index 0000000000..1f918135c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/StudentResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StudentResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "students")] + #pragma warning disable CS1591 + Students, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs new file mode 100644 index 0000000000..04be63b9a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TeacherIdentifierInRequest : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs new file mode 100644 index 0000000000..dceef67fe8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TeacherIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TeacherIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipIdentifier.cs new file mode 100644 index 0000000000..3bd3c63ac1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TeacherMentorsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TeacherMentorsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipName.cs new file mode 100644 index 0000000000..c38fd9dcbd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherMentorsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TeacherMentorsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "mentors")] + #pragma warning disable CS1591 + Mentors, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherResourceType.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherResourceType.cs new file mode 100644 index 0000000000..71268c8d92 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TeacherResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "teachers")] + #pragma warning disable CS1591 + Teachers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipIdentifier.cs new file mode 100644 index 0000000000..baa6632ac0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TeacherTeachesRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TeacherTeachesRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipName.cs new file mode 100644 index 0000000000..29bc97b81e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/TeacherTeachesRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TeacherTeachesRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "teaches")] + #pragma warning disable CS1591 + Teaches, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs new file mode 100644 index 0000000000..69679e4bbe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyCourseInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyCourseInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInResponse.cs new file mode 100644 index 0000000000..bf13a03b2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyCourseInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyCourseInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyCourseInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyCourseInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs new file mode 100644 index 0000000000..83d746d704 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyEnrollmentInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyEnrollmentInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInResponse.cs new file mode 100644 index 0000000000..28307d2486 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyEnrollmentInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyEnrollmentInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyEnrollmentInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyEnrollmentInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs new file mode 100644 index 0000000000..2fc8bbb3a1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStudentInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStudentInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInResponse.cs new file mode 100644 index 0000000000..b73621fb3c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyStudentInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStudentInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStudentInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyStudentInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs new file mode 100644 index 0000000000..6b2fc5e5a1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTeacherInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTeacherInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInResponse.cs new file mode 100644 index 0000000000..33053d4b3c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToManyTeacherInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyTeacherInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyTeacherInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToManyTeacherInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs new file mode 100644 index 0000000000..daf757b4e8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneCourseInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneCourseInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInResponse.cs new file mode 100644 index 0000000000..534a18ec45 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneCourseInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneCourseInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneCourseInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneCourseInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs new file mode 100644 index 0000000000..b15e0172cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneStudentInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneStudentInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInResponse.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInResponse.cs new file mode 100644 index 0000000000..84132992cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/ToOneStudentInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneStudentInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneStudentInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ToOneStudentInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseEnrollmentsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseEnrollmentsRelationshipOperation.cs new file mode 100644 index 0000000000..72b9383be9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseEnrollmentsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateCourseEnrollmentsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseEnrollmentsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseEnrollmentsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseEnrollmentsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseOperation.cs new file mode 100644 index 0000000000..58d63499a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateCourseOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateCourseOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateCourseOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateCourseRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentCourseRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentCourseRelationshipOperation.cs new file mode 100644 index 0000000000..5e44dc1f5e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentCourseRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateEnrollmentCourseRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentCourseRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentCourseRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentCourseRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentCourseRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentOperation.cs new file mode 100644 index 0000000000..f814569a20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateEnrollmentOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateEnrollmentRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentStudentRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentStudentRelationshipOperation.cs new file mode 100644 index 0000000000..363e0e09d5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateEnrollmentStudentRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateEnrollmentStudentRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentStudentRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentStudentRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateEnrollmentStudentRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentStudentRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateOperationCode.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..fda09b4cd2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentEnrollmentsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentEnrollmentsRelationshipOperation.cs new file mode 100644 index 0000000000..9eb0022467 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentEnrollmentsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateStudentEnrollmentsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentEnrollmentsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentEnrollmentsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.EnrollmentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentEnrollmentsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentMentorRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentMentorRelationshipOperation.cs new file mode 100644 index 0000000000..a761aef583 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentMentorRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateStudentMentorRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentMentorRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentMentorRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentMentorRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentMentorRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentOperation.cs new file mode 100644 index 0000000000..c076f9c709 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateStudentOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateStudentOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateStudentOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateStudentRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherMentorsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherMentorsRelationshipOperation.cs new file mode 100644 index 0000000000..775b95205f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherMentorsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTeacherMentorsRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherMentorsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherMentorsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.StudentIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherMentorsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherOperation.cs new file mode 100644 index 0000000000..000f450288 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTeacherOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.DataInUpdateTeacherRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherTeachesRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherTeachesRelationshipOperation.cs new file mode 100644 index 0000000000..5fc1ed4951 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Models/UpdateTeacherTeachesRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTeacherTeachesRelationshipOperation : global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherTeachesRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.UpdateTeacherTeachesRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.CourseIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.TeacherTeachesRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..7ba9ad8e64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/AtomicOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.AtomicOperations.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs new file mode 100644 index 0000000000..d22e9e8cc2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs @@ -0,0 +1,273 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ClientIdGenerationModes; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes; + +public sealed class ClientIdGenerationModesTests + : IClassFixture, ClientIdGenerationDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ClientIdGenerationDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ClientIdGenerationFakers _fakers = new(); + + public ClientIdGenerationModesTests(IntegrationTestContext, ClientIdGenerationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + } + + [Fact] + public async Task Cannot_create_resource_without_ID_when_supplying_ID_is_required() + { + // Arrange + Player newPlayer = _fakers.Player.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreatePlayerRequestDocument + { + Data = new DataInCreatePlayerRequest + { + Type = ResourceType.Players, + Attributes = new AttributesInCreatePlayerRequest + { + UserName = newPlayer.UserName + } + } + }; + + // Act + Func action = async () => _ = await apiClient.Players.PostAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors[0]; + error.Status.Should().Be("422"); + error.Title.Should().Be("Failed to deserialize request body: The 'id' element is required."); + error.Detail.Should().BeNull(); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/data"); + } + + [Fact] + public async Task Can_create_resource_with_ID_when_supplying_ID_is_required() + { + // Arrange + Player newPlayer = _fakers.Player.GenerateOne(); + newPlayer.Id = Guid.NewGuid(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreatePlayerRequestDocument + { + Data = new DataInCreatePlayerRequest + { + Type = ResourceType.Players, + Id = newPlayer.Id, + Attributes = new AttributesInCreatePlayerRequest + { + UserName = newPlayer.UserName + } + } + }; + + // Act + PrimaryPlayerResponseDocument? response = await apiClient.Players.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Player playerInDatabase = await dbContext.Players.FirstWithIdAsync(newPlayer.Id); + + playerInDatabase.UserName.Should().Be(newPlayer.UserName); + }); + } + + [Fact] + public async Task Can_create_resource_without_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game newGame = _fakers.Game.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Type = ResourceType.Games, + Attributes = new AttributesInCreateGameRequest + { + Title = newGame.Title, + PurchasePrice = (double)newGame.PurchasePrice + } + } + }; + + // Act + PrimaryGameResponseDocument? response = await apiClient.Games.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().NotBeNull(); + response.Data.Id.Value.Should().NotBe(Guid.Empty); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Game gameInDatabase = await dbContext.Games.FirstWithIdAsync(response.Data.Id.Value); + + gameInDatabase.Title.Should().Be(newGame.Title); + gameInDatabase.PurchasePrice.Should().Be(newGame.PurchasePrice); + }); + } + + [Fact] + public async Task Can_create_resource_with_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game newGame = _fakers.Game.GenerateOne(); + newGame.Id = Guid.NewGuid(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Type = ResourceType.Games, + Id = newGame.Id, + Attributes = new AttributesInCreateGameRequest + { + Title = newGame.Title, + PurchasePrice = (double)newGame.PurchasePrice + } + } + }; + + // Act + PrimaryGameResponseDocument? response = await apiClient.Games.PostAsync(requestBody); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Game gameInDatabase = await dbContext.Games.FirstWithIdAsync(newGame.Id); + + gameInDatabase.Title.Should().Be(newGame.Title); + gameInDatabase.PurchasePrice.Should().Be(newGame.PurchasePrice); + }); + } + + [Fact] + public async Task Cannot_create_resource_with_existing_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game existingGame = _fakers.Game.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Games.Add(existingGame); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Type = ResourceType.Games, + Id = existingGame.Id, + Attributes = new AttributesInCreateGameRequest + { + Title = existingGame.Title, + PurchasePrice = (double)existingGame.PurchasePrice + } + } + }; + + // Act + Func action = async () => _ = await apiClient.Games.PostAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Another resource with the specified ID already exists."); + error.Detail.Should().Be($"Another resource of type 'games' with ID '{existingGame.StringId}' already exists."); + } + + [Fact] + public async Task Can_create_resource_without_ID_when_supplying_ID_is_forbidden() + { + // Arrange + PlayerGroup newPlayerGroup = _fakers.Group.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ClientIdGenerationModesClient apiClient = new(requestAdapter); + + var requestBody = new CreatePlayerGroupRequestDocument + { + Data = new DataInCreatePlayerGroupRequest + { + Type = ResourceType.PlayerGroups, + Attributes = new AttributesInCreatePlayerGroupRequest + { + Name = newPlayerGroup.Name + } + } + }; + + // Act + PrimaryPlayerGroupResponseDocument? response = await apiClient.PlayerGroups.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().NotBeNullOrEmpty(); + + long newPlayerGroupId = long.Parse(response.Data.Id); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + PlayerGroup playerGroupInDatabase = await dbContext.PlayerGroups.FirstWithIdAsync(newPlayerGroupId); + + playerGroupInDatabase.Name.Should().Be(newPlayerGroup.Name); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/ClientIdGenerationModesClient.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/ClientIdGenerationModesClient.cs new file mode 100644 index 0000000000..28acff595c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/ClientIdGenerationModesClient.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ClientIdGenerationModesClient : BaseRequestBuilder + { + /// The games property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games.GamesRequestBuilder Games + { + get => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games.GamesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The playerGroups property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups.PlayerGroupsRequestBuilder PlayerGroups + { + get => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups.PlayerGroupsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The players property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players.PlayersRequestBuilder Players + { + get => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players.PlayersRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public ClientIdGenerationModesClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs new file mode 100644 index 0000000000..9c43818ad9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Games/GamesRequestBuilder.cs @@ -0,0 +1,103 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games +{ + /// + /// Builds and executes requests for operations under \games + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class GamesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public GamesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/games{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public GamesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/games{?query*}", rawUrl) + { + } + + /// + /// Creates a new game. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new game. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games.GamesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Games.GamesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new game. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class GamesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs new file mode 100644 index 0000000000..81b6dad5b4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateGameRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateGameRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The purchasePrice property + public double? PurchasePrice + { + get { return BackingStore?.Get("purchasePrice"); } + set { BackingStore?.Set("purchasePrice", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "purchasePrice", n => { PurchasePrice = n.GetDoubleValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("purchasePrice", PurchasePrice); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs new file mode 100644 index 0000000000..a0890d42e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerGroupRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs new file mode 100644 index 0000000000..0e08fbe104 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreatePlayerRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "userName", n => { UserName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("userName", UserName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..5661aa5ced --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs new file mode 100644 index 0000000000..83699cbc7c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInGameResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInGameResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The purchasePrice property + public double? PurchasePrice + { + get { return BackingStore?.Get("purchasePrice"); } + set { BackingStore?.Set("purchasePrice", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "purchasePrice", n => { PurchasePrice = n.GetDoubleValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("purchasePrice", PurchasePrice); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs new file mode 100644 index 0000000000..07adaf6403 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerGroupResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs new file mode 100644 index 0000000000..e23122f9dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInPlayerResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "userName", n => { UserName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("userName", UserName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..e56ce8d295 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs new file mode 100644 index 0000000000..e248697cda --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreateGameRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateGameRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateGameRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreateGameRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs new file mode 100644 index 0000000000..6625e35064 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerGroupRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreatePlayerGroupRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreatePlayerGroupRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs new file mode 100644 index 0000000000..addd7b6224 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/CreatePlayerRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreatePlayerRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreatePlayerRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs new file mode 100644 index 0000000000..b9c39a55b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreateGameRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateGameRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreateGameRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs new file mode 100644 index 0000000000..273cdc05f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerGroupRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs new file mode 100644 index 0000000000..674f245d09 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInCreatePlayerRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs new file mode 100644 index 0000000000..f4dfd7903c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInGameResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInGameResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInGameResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs new file mode 100644 index 0000000000..4f340d6718 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerGroupResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs new file mode 100644 index 0000000000..cf01cc0cb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/DataInPlayerResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.AttributesInPlayerResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..2f02de5cc3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..3a4c7d8b81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..d241bf29b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..ba320e7863 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..6248e2193b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs new file mode 100644 index 0000000000..ebb12863b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class GameIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetGuidValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteGuidValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs new file mode 100644 index 0000000000..57894ff37c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class GameIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public GameIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameResourceType.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameResourceType.cs new file mode 100644 index 0000000000..9b3cf95ac3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/GameResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum GameResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "games")] + #pragma warning disable CS1591 + Games, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..da6c488aca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..ed1e881c84 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs new file mode 100644 index 0000000000..ac6196074a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PlayerGroupIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs new file mode 100644 index 0000000000..f0ca1c3b46 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PlayerGroupIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PlayerGroupIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupResourceType.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupResourceType.cs new file mode 100644 index 0000000000..b5f7d16eb5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerGroupResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum PlayerGroupResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "playerGroups")] + #pragma warning disable CS1591 + PlayerGroups, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs new file mode 100644 index 0000000000..ad41f6900e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PlayerIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetGuidValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteGuidValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs new file mode 100644 index 0000000000..ad0022f548 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PlayerIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PlayerIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerResourceType.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerResourceType.cs new file mode 100644 index 0000000000..02f282b648 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PlayerResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum PlayerResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "players")] + #pragma warning disable CS1591 + Players, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs new file mode 100644 index 0000000000..eb87b15731 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryGameResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryGameResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryGameResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryGameResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs new file mode 100644 index 0000000000..ebb52b48cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerGroupResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryPlayerGroupResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryPlayerGroupResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs new file mode 100644 index 0000000000..86ba7e7572 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/PrimaryPlayerResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryPlayerResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryPlayerResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..5c5d1d84f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs new file mode 100644 index 0000000000..ac7620c563 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerGroupRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreatePlayerGroupRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The players property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest? Players + { + get { return BackingStore?.Get("players"); } + set { BackingStore?.Set("players", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "players", n => { Players = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("players", Players); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs new file mode 100644 index 0000000000..9ebc8c4db9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreatePlayerRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreatePlayerRequest : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The memberOf property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest? MemberOf + { + get { return BackingStore?.Get("memberOf"); } + set { BackingStore?.Set("memberOf", value); } + } + + /// The ownedGames property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInRequest? OwnedGames + { + get { return BackingStore?.Get("ownedGames"); } + set { BackingStore?.Set("ownedGames", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "memberOf", n => { MemberOf = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest.CreateFromDiscriminatorValue); } }, + { "ownedGames", n => { OwnedGames = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("memberOf", MemberOf); + writer.WriteObjectValue("ownedGames", OwnedGames); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..7be2a2fe20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs new file mode 100644 index 0000000000..289181d405 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerGroupResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInPlayerGroupResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The players property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse? Players + { + get { return BackingStore?.Get("players"); } + set { BackingStore?.Set("players", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "players", n => { Players = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("players", Players); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs new file mode 100644 index 0000000000..15bff75fb5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInPlayerResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInPlayerResponse : global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The memberOf property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse? MemberOf + { + get { return BackingStore?.Get("memberOf"); } + set { BackingStore?.Set("memberOf", value); } + } + + /// The ownedGames property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInResponse? OwnedGames + { + get { return BackingStore?.Get("ownedGames"); } + set { BackingStore?.Set("ownedGames", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "memberOf", n => { MemberOf = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse.CreateFromDiscriminatorValue); } }, + { "ownedGames", n => { OwnedGames = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("memberOf", MemberOf); + writer.WriteObjectValue("ownedGames", OwnedGames); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..437b617413 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..d088941ea4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreateGameRequest(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerGroupRequest(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInCreatePlayerRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..422dc8da2f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "games" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInGameResponse(), + "playerGroups" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerGroupResponse(), + "players" => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.DataInPlayerResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..38baa2821d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..029aebb185 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..85f3a3aaeb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "games")] + #pragma warning disable CS1591 + Games, + #pragma warning restore CS1591 + [EnumMember(Value = "playerGroups")] + #pragma warning disable CS1591 + PlayerGroups, + #pragma warning restore CS1591 + [EnumMember(Value = "players")] + #pragma warning disable CS1591 + Players, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs new file mode 100644 index 0000000000..9e228a880a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyGameInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyGameInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs new file mode 100644 index 0000000000..ddfc87aeed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyGameInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyGameInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyGameInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyGameInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.GameIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs new file mode 100644 index 0000000000..cf529fb67e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyPlayerGroupInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyPlayerGroupInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs new file mode 100644 index 0000000000..67dafa1e59 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerGroupInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyPlayerGroupInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyPlayerGroupInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerGroupInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerGroupIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs new file mode 100644 index 0000000000..5c0824035b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyPlayerInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyPlayerInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs new file mode 100644 index 0000000000..4b17c25cc3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Models/ToManyPlayerInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyPlayerInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyPlayerInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ToManyPlayerInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PlayerIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs new file mode 100644 index 0000000000..c7ba47a086 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/PlayerGroups/PlayerGroupsRequestBuilder.cs @@ -0,0 +1,105 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups +{ + /// + /// Builds and executes requests for operations under \playerGroups + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PlayerGroupsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PlayerGroupsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/playerGroups{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PlayerGroupsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/playerGroups{?query*}", rawUrl) + { + } + + /// + /// Creates a new playerGroup. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerGroupResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new playerGroup. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerGroupRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups.PlayerGroupsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.PlayerGroups.PlayerGroupsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new playerGroup. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PlayerGroupsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs new file mode 100644 index 0000000000..f88f040c6e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ClientIdGenerationModes/GeneratedCode/Players/PlayersRequestBuilder.cs @@ -0,0 +1,103 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players +{ + /// + /// Builds and executes requests for operations under \players + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PlayersRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public PlayersRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/players{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public PlayersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/players{?query*}", rawUrl) + { + } + + /// + /// Creates a new player. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.PrimaryPlayerResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new player. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Models.CreatePlayerRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players.PlayersRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ClientIdGenerationModes.GeneratedCode.Players.PlayersRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new player. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class PlayersRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs b/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs new file mode 100644 index 0000000000..0020d1d174 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/ETagTests.cs @@ -0,0 +1,244 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using Microsoft.Kiota.Http.HttpClientLibrary.Middleware.Options; +using Microsoft.Net.Http.Headers; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.Headers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.Headers; + +public sealed class ETagTests : IClassFixture, HeaderDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, HeaderDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly HeaderFakers _fakers = new(); + + public ETagTests(IntegrationTestContext, HeaderDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Returns_ETag_for_HEAD_request() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + await apiClient.Countries.HeadAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + string[] eTagHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + } + + [Fact] + public async Task Returns_ETag_for_GET_request() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + CountryCollectionResponseDocument? response = await apiClient.Countries.GetAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + response.Should().NotBeNull(); + + string[] eTagHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + } + + [Fact] + public async Task Returns_no_ETag_for_failed_GET_request() + { + // Arrange + Guid unknownCountryId = Unknown.TypedId.Guid; + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + Func action = async () => await apiClient.Countries[unknownCountryId].GetAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'countries' with ID '{unknownCountryId}' does not exist."); + + headerInspector.ResponseHeaders.Should().NotContainKey(HeaderNames.ETag); + } + + [Fact] + public async Task Returns_no_ETag_for_POST_request() + { + // Arrange + Country newCountry = _fakers.Country.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + var requestBody = new CreateCountryRequestDocument + { + Data = new DataInCreateCountryRequest + { + Type = ResourceType.Countries, + Attributes = new AttributesInCreateCountryRequest + { + Name = newCountry.Name, + Population = newCountry.Population + } + } + }; + + // Act + PrimaryCountryResponseDocument? response = + await apiClient.Countries.PostAsync(requestBody, configuration => configuration.Options.Add(headerInspector)); + + // Assert + response.Should().NotBeNull(); + + headerInspector.ResponseHeaders.Should().NotContainKey(HeaderNames.ETag); + } + + [Fact] + public async Task Returns_NotModified_for_matching_ETag() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + _ = await apiClient.Countries.GetAsync(configuration => configuration.Options.Add(headerInspector)); + + string responseETag = headerInspector.ResponseHeaders[HeaderNames.ETag].Single(); + headerInspector.ResponseHeaders.Clear(); + + // Act + Func action = async () => await apiClient.Countries.GetAsync(configuration => + { + configuration.Headers.Add(HeaderNames.IfNoneMatch, responseETag); + configuration.Options.Add(headerInspector); + }); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.Message.Should().Be("The server returned an unexpected status code and no error factory is registered for this code: 304"); + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotModified); + + string[] eTagHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Be(responseETag); + } + + [Fact] + public async Task Returns_content_for_mismatching_ETag() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + CountryCollectionResponseDocument? response = await apiClient.Countries.GetAsync(configuration => + { + configuration.Headers.Add(HeaderNames.IfNoneMatch, "\"Not-a-matching-value\""); + configuration.Options.Add(headerInspector); + }); + + // Assert + response.Should().NotBeNull(); + + string[] eTagHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs new file mode 100644 index 0000000000..806b7443ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/CountriesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries +{ + /// + /// Builds and executes requests for operations under \countries + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.Headers.GeneratedCode.countries.item collection + /// The identifier of the country to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.CountriesItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.CountriesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CountriesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CountriesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of countries. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new country. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of countries. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new country. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.CountriesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.CountriesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of countries. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new country. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/CountriesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/CountriesItemRequestBuilder.cs new file mode 100644 index 0000000000..7dc4b09903 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/CountriesItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item +{ + /// + /// Builds and executes requests for operations under \countries\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesItemRequestBuilder : BaseRequestBuilder + { + /// The languages property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages.LanguagesRequestBuilder Languages + { + get => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages.LanguagesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CountriesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CountriesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing country by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual country by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing country. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing country by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual country by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing country. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.CountriesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.CountriesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual country by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing country. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CountriesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Languages/LanguagesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Languages/LanguagesRequestBuilder.cs new file mode 100644 index 0000000000..754319b921 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Languages/LanguagesRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages +{ + /// + /// Builds and executes requests for operations under \countries\{id}\languages + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LanguagesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/languages{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LanguagesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/languages{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related languages of an individual country's languages relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related languages of an individual country's languages relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages.LanguagesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Languages.LanguagesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related languages of an individual country's languages relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/Languages/LanguagesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/Languages/LanguagesRequestBuilder.cs new file mode 100644 index 0000000000..b7c239dca4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/Languages/LanguagesRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages +{ + /// + /// Builds and executes requests for operations under \countries\{id}\relationships\languages + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LanguagesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/relationships/languages{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LanguagesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/relationships/languages{?query*}", rawUrl) + { + } + + /// + /// Removes existing languages from the languages relationship of an individual country. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related language identities of an individual country's languages relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing languages to the languages relationship of an individual country. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing languages to the languages relationship of an individual country. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing languages from the languages relationship of an individual country. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related language identities of an individual country's languages relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing languages to the languages relationship of an individual country. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing languages to the languages relationship of an individual country. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages.LanguagesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages.LanguagesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related language identities of an individual country's languages relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LanguagesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..81d3e29f45 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Countries/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \countries\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The languages property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages.LanguagesRequestBuilder Languages + { + get => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.Item.Relationships.Languages.LanguagesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/countries/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/HeadersClient.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/HeadersClient.cs new file mode 100644 index 0000000000..2d6d36e4cb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/HeadersClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class HeadersClient : BaseRequestBuilder + { + /// The countries property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.CountriesRequestBuilder Countries + { + get => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Countries.CountriesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public HeadersClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCountryResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCountryResponse.cs new file mode 100644 index 0000000000..cfea68f989 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCountryResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCountryResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The population property + public long? Population + { + get { return BackingStore?.Get("population"); } + set { BackingStore?.Set("population", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "population", n => { Population = n.GetLongValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteLongValue("population", Population); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs new file mode 100644 index 0000000000..6b7377a82c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateCountryRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The population property + public long? Population + { + get { return BackingStore?.Get("population"); } + set { BackingStore?.Set("population", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "population", n => { Population = n.GetLongValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteLongValue("population", Population); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..14dbfd1efb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs new file mode 100644 index 0000000000..32d71abd9e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInLanguageResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLanguageResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "code", n => { Code = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..496a044efd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse(), + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs new file mode 100644 index 0000000000..9b2f761daf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateCountryRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The population property + public long? Population + { + get { return BackingStore?.Get("population"); } + set { BackingStore?.Set("population", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "population", n => { Population = n.GetLongValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteLongValue("population", Population); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..6fd015c7a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs new file mode 100644 index 0000000000..af711e741b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CountryCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CountryCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CountryCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CountryCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs new file mode 100644 index 0000000000..0526ef9d9c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/CreateCountryRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateCountryRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateCountryRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.CreateCountryRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs new file mode 100644 index 0000000000..2712a0367a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCountryResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCountryResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCountryResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs new file mode 100644 index 0000000000..7ce74c8b3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInCreateCountryRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInCreateCountryRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs new file mode 100644 index 0000000000..fb9e4a1a67 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInLanguageResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLanguageResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInLanguageResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs new file mode 100644 index 0000000000..38bcdbfc4e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/DataInUpdateCountryRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.AttributesInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..4a2fe613b1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..3badeb7798 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..005c07a0a8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..0fae23f5a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..d8154a4f2c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..e84a79dd0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs new file mode 100644 index 0000000000..96fda5b57a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LanguageCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public LanguageCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..e549d2c4d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LanguageIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public LanguageIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs new file mode 100644 index 0000000000..c1fbd8c800 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LanguageIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetGuidValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteGuidValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs new file mode 100644 index 0000000000..3c22a07b8e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LanguageIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public LanguageIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageResourceType.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageResourceType.cs new file mode 100644 index 0000000000..136ee3f03a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/LanguageResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum LanguageResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "languages")] + #pragma warning disable CS1591 + Languages, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..52be8b831f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs new file mode 100644 index 0000000000..0f01d96dc2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/PrimaryCountryResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryCountryResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryCountryResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.PrimaryCountryResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..d2e8736256 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs new file mode 100644 index 0000000000..ad553a7e9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCountryResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCountryResponse : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The languages property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse? Languages + { + get { return BackingStore?.Get("languages"); } + set { BackingStore?.Set("languages", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("languages", Languages); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs new file mode 100644 index 0000000000..420df477b8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateCountryRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The languages property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest? Languages + { + get { return BackingStore?.Get("languages"); } + set { BackingStore?.Set("languages", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("languages", Languages); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..2bc115a97e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..79baa9aa61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInCountryResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs new file mode 100644 index 0000000000..534b24bdf8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateCountryRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateCountryRequest : global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The languages property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest? Languages + { + get { return BackingStore?.Get("languages"); } + set { BackingStore?.Set("languages", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "languages", n => { Languages = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("languages", Languages); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..eac5fe2ed1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..3e601e6251 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..fcbe538659 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..b5cf81cd00 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCreateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..8cbdaf46ed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInCountryResponse(), + "languages" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInLanguageResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..09f5c48d1a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "countries" => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..42f9aaa346 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..177c956af0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..b43e2a7d26 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "countries")] + #pragma warning disable CS1591 + Countries, + #pragma warning restore CS1591 + [EnumMember(Value = "languages")] + #pragma warning disable CS1591 + Languages, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs new file mode 100644 index 0000000000..21a29da60b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyLanguageInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyLanguageInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs new file mode 100644 index 0000000000..13fb140c45 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/ToManyLanguageInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyLanguageInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyLanguageInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.ToManyLanguageInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.LanguageIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs new file mode 100644 index 0000000000..468b58fdc7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/GeneratedCode/Models/UpdateCountryRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateCountryRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateCountryRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.UpdateCountryRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.DataInUpdateCountryRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs b/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs new file mode 100644 index 0000000000..b42071a6af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Headers/HeaderTests.cs @@ -0,0 +1,192 @@ +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using Microsoft.Kiota.Http.HttpClientLibrary.Middleware.Options; +using Microsoft.Net.Http.Headers; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode; +using OpenApiKiotaEndToEndTests.Headers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.Headers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.Headers; + +public sealed class HeaderTests : IClassFixture, HeaderDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, HeaderDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly HeaderFakers _fakers = new(); + + public HeaderTests(IntegrationTestContext, HeaderDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Returns_Location_for_post_resource_request() + { + // Arrange + Country newCountry = _fakers.Country.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + var requestBody = new CreateCountryRequestDocument + { + Data = new DataInCreateCountryRequest + { + Type = ResourceType.Countries, + Attributes = new AttributesInCreateCountryRequest + { + Name = newCountry.Name, + Population = newCountry.Population + } + } + }; + + // Act + PrimaryCountryResponseDocument? response = + await apiClient.Countries.PostAsync(requestBody, configuration => configuration.Options.Add(headerInspector)); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + + string[] locationHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.Location).WhoseValue.ToArray(); + locationHeaderValues.Should().HaveCount(1); + locationHeaderValues[0].Should().Be($"/countries/{response.Data.Id}"); + } + + [Fact] + public async Task Returns_ContentLength_for_head_primary_resources_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + await apiClient.Countries.HeadAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + string[] contentLengthHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_primary_resource_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + await apiClient.Countries[existingCountry.Id].HeadAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + string[] contentLengthHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_secondary_resource_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + existingCountry.Languages = _fakers.Language.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + await apiClient.Countries[existingCountry.Id].Languages.HeadAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + string[] contentLengthHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_relationship_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + existingCountry.Languages = _fakers.Language.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new HeadersClient(requestAdapter); + + var headerInspector = new HeadersInspectionHandlerOption + { + InspectResponseHeaders = true + }; + + // Act + await apiClient.Countries[existingCountry.Id].Relationships.Languages.HeadAsync(configuration => configuration.Options.Add(headerInspector)); + + // Assert + string[] contentLengthHeaderValues = headerInspector.ResponseHeaders.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs new file mode 100644 index 0000000000..b27fbf28fe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -0,0 +1,60 @@ +using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.Links; +using Swashbuckle.AspNetCore.Swagger; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.Links; + +public sealed class AlternateOpenApiRouteTests : IClassFixture, LinkDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, LinkDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly LinkFakers _fakers = new(); + + public AlternateOpenApiRouteTests(IntegrationTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.ConfigureServices(services => + services.Configure(options => options.RouteTemplate = "/api-docs/{documentName}/swagger.yaml")); + + testContext.UseController(); + } + + [Fact] + public async Task DescribedBy_link_matches_alternate_OpenAPI_route() + { + // Arrange + Excursion excursion = _fakers.Excursion.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new LinksClient(requestAdapter); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Excursions.Add(excursion); + await dbContext.SaveChangesAsync(); + }); + + // Act + PrimaryExcursionResponseDocument? response = await apiClient.Excursions[excursion.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Links.Should().NotBeNull(); + response.Links.Describedby.Should().Be("/api-docs/v1/swagger.yaml"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs new file mode 100644 index 0000000000..0e9bc39d41 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/AccommodationsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations +{ + /// + /// Builds and executes requests for operations under \accommodations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.accommodations.item collection + /// The identifier of the accommodation to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item.AccommodationsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item.AccommodationsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of accommodations. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new accommodation. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of accommodations. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new accommodation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.AccommodationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.AccommodationsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of accommodations. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new accommodation. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs new file mode 100644 index 0000000000..145408614f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Accommodations/Item/AccommodationsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item +{ + /// + /// Builds and executes requests for operations under \accommodations\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/accommodations/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing accommodation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual accommodation by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing accommodation. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing accommodation by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual accommodation by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing accommodation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item.AccommodationsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.Item.AccommodationsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual accommodation by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing accommodation. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..c522dd0299 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions +{ + /// + /// Builds and executes requests for operations under \excursions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.excursions.item collection + /// The identifier of the excursion to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item.ExcursionsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item.ExcursionsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of excursions. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new excursion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of excursions. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new excursion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.ExcursionsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of excursions. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new excursion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs new file mode 100644 index 0000000000..97119404bd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Excursions/Item/ExcursionsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item +{ + /// + /// Builds and executes requests for operations under \excursions\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/excursions/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing excursion by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual excursion by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing excursion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing excursion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual excursion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing excursion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item.ExcursionsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.Item.ExcursionsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual excursion by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing excursion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs new file mode 100644 index 0000000000..1131bc2a70 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/LinksClient.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LinksClient : BaseRequestBuilder + { + /// The accommodations property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.AccommodationsRequestBuilder Accommodations + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Accommodations.AccommodationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.ExcursionsRequestBuilder Excursions + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Excursions.ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The transports property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.TransportsRequestBuilder Transports + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.TransportsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The vacations property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.VacationsRequestBuilder Vacations + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.VacationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public LinksClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs new file mode 100644 index 0000000000..fb7558f277 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AccommodationCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AccommodationCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs new file mode 100644 index 0000000000..aae4d490d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AccommodationIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs new file mode 100644 index 0000000000..991f213ec9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AccommodationIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AccommodationIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs new file mode 100644 index 0000000000..8ae07dbd2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AccommodationIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AccommodationIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs new file mode 100644 index 0000000000..69079e56b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AccommodationResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum AccommodationResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "accommodations")] + #pragma warning disable CS1591 + Accommodations, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs new file mode 100644 index 0000000000..08015788a2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInAccommodationResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInAccommodationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The address property + public string? Address + { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "address", n => { Address = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("address", Address); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs new file mode 100644 index 0000000000..99ccaec809 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateAccommodationRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The address property + public string? Address + { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "address", n => { Address = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("address", Address); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs new file mode 100644 index 0000000000..2479302ede --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateExcursionRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The occursAt property + public DateTimeOffset? OccursAt + { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..bcca0e9803 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs new file mode 100644 index 0000000000..06f4cf39e3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateTransportRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The durationInMinutes property + public int? DurationInMinutes + { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + + /// The type property + public int? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + { "type", n => { Type = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs new file mode 100644 index 0000000000..811ad4e362 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInCreateVacationRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The endsAt property + public DateTimeOffset? EndsAt + { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + + /// The startsAt property + public DateTimeOffset? StartsAt + { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs new file mode 100644 index 0000000000..7c831ef525 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInExcursionResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInExcursionResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The occursAt property + public DateTimeOffset? OccursAt + { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..cb3437aec3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs new file mode 100644 index 0000000000..ae69b72286 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInTransportResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInTransportResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The durationInMinutes property + public int? DurationInMinutes + { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + + /// The type property + public int? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + { "type", n => { Type = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs new file mode 100644 index 0000000000..a407e9978b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateAccommodationRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The address property + public string? Address + { + get { return BackingStore?.Get("address"); } + set { BackingStore?.Set("address", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "address", n => { Address = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("address", Address); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs new file mode 100644 index 0000000000..f69cac01a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateExcursionRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The description property + public string? Description + { + get { return BackingStore?.Get("description"); } + set { BackingStore?.Set("description", value); } + } + + /// The occursAt property + public DateTimeOffset? OccursAt + { + get { return BackingStore?.Get("occursAt"); } + set { BackingStore?.Set("occursAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "description", n => { Description = n.GetStringValue(); } }, + { "occursAt", n => { OccursAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("description", Description); + writer.WriteDateTimeOffsetValue("occursAt", OccursAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..5deb0f1a93 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs new file mode 100644 index 0000000000..3450183500 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateTransportRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The durationInMinutes property + public int? DurationInMinutes + { + get { return BackingStore?.Get("durationInMinutes"); } + set { BackingStore?.Set("durationInMinutes", value); } + } + + /// The type property + public int? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "durationInMinutes", n => { DurationInMinutes = n.GetIntValue(); } }, + { "type", n => { Type = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("durationInMinutes", DurationInMinutes); + writer.WriteIntValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs new file mode 100644 index 0000000000..4826779630 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInUpdateVacationRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The endsAt property + public DateTimeOffset? EndsAt + { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + + /// The startsAt property + public DateTimeOffset? StartsAt + { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs new file mode 100644 index 0000000000..2f19135f5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/AttributesInVacationResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The endsAt property + public DateTimeOffset? EndsAt + { + get { return BackingStore?.Get("endsAt"); } + set { BackingStore?.Set("endsAt", value); } + } + + /// The startsAt property + public DateTimeOffset? StartsAt + { + get { return BackingStore?.Get("startsAt"); } + set { BackingStore?.Set("startsAt", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "endsAt", n => { EndsAt = n.GetDateTimeOffsetValue(); } }, + { "startsAt", n => { StartsAt = n.GetDateTimeOffsetValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDateTimeOffsetValue("endsAt", EndsAt); + writer.WriteDateTimeOffsetValue("startsAt", StartsAt); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs new file mode 100644 index 0000000000..88fb66d856 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateAccommodationRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateAccommodationRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateAccommodationRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateAccommodationRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs new file mode 100644 index 0000000000..9a9ec39d7c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateExcursionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateExcursionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateExcursionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateExcursionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs new file mode 100644 index 0000000000..3eb47dd37a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateTransportRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateTransportRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateTransportRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs new file mode 100644 index 0000000000..58660a4c20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/CreateVacationRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateVacationRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateVacationRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs new file mode 100644 index 0000000000..0897645649 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInAccommodationResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInAccommodationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInAccommodationResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs new file mode 100644 index 0000000000..c15b5b21e8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateAccommodationRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateAccommodationRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs new file mode 100644 index 0000000000..e0601a86b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateExcursionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateExcursionRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs new file mode 100644 index 0000000000..7fe0892ac9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateTransportRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateTransportRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs new file mode 100644 index 0000000000..c17c50264f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInCreateVacationRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInCreateVacationRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs new file mode 100644 index 0000000000..c18d507d5c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInExcursionResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInExcursionResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInExcursionResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs new file mode 100644 index 0000000000..4c0d872b89 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInTransportResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInTransportResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInTransportResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs new file mode 100644 index 0000000000..16d4fd8a2c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateAccommodationRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateAccommodationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs new file mode 100644 index 0000000000..e25c8fbfab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateExcursionRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateExcursionRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs new file mode 100644 index 0000000000..797d61a73d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateTransportRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateTransportRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateTransportRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs new file mode 100644 index 0000000000..a53cee4371 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInUpdateVacationRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs new file mode 100644 index 0000000000..1cad15d111 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/DataInVacationResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AttributesInVacationResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..bdba746cc4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..80d825c917 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..c36db2256c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..3164110971 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..300ddff394 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs new file mode 100644 index 0000000000..bde5dd575c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ExcursionCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ExcursionCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..1a51a7b660 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ExcursionIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ExcursionIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs new file mode 100644 index 0000000000..5ff36171cf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ExcursionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs new file mode 100644 index 0000000000..9d2d3ffd44 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ExcursionIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ExcursionIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs new file mode 100644 index 0000000000..36480b06b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ExcursionResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ExcursionResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "excursions")] + #pragma warning disable CS1591 + Excursions, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..2909b955ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..c6718c7d6b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs new file mode 100644 index 0000000000..2956c71ea8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableSecondaryTransportResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableSecondaryTransportResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableSecondaryTransportResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs new file mode 100644 index 0000000000..84e33c6676 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneTransportInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneTransportInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs new file mode 100644 index 0000000000..9a0c40af4b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableToOneTransportInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneTransportInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneTransportInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs new file mode 100644 index 0000000000..f98b944aa7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/NullableTransportIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableTransportIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableTransportIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs new file mode 100644 index 0000000000..c06dd1abeb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryAccommodationResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryAccommodationResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryAccommodationResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryAccommodationResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs new file mode 100644 index 0000000000..8b690688d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryExcursionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryExcursionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryExcursionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryExcursionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs new file mode 100644 index 0000000000..09bb6d5cb5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryTransportResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryTransportResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryTransportResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs new file mode 100644 index 0000000000..aa4f702d38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/PrimaryVacationResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryVacationResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryVacationResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..cb51f647c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..59563b8f0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs new file mode 100644 index 0000000000..c4e7a6032b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInCreateVacationRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The accommodation property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest? Accommodation + { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest? Excursions + { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } + + /// The transport property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest? Transport + { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInCreateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, + { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, + { "transport", n => { Transport = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..aff2fbf974 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..c0d40587cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs new file mode 100644 index 0000000000..8579e6ef66 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInUpdateVacationRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateVacationRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The accommodation property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest? Accommodation + { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest? Excursions + { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } + + /// The transport property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest? Transport + { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInUpdateVacationRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest.CreateFromDiscriminatorValue); } }, + { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest.CreateFromDiscriminatorValue); } }, + { "transport", n => { Transport = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs new file mode 100644 index 0000000000..180d1aab6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/RelationshipsInVacationResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInVacationResponse : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The accommodation property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInResponse? Accommodation + { + get { return BackingStore?.Get("accommodation"); } + set { BackingStore?.Set("accommodation", value); } + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse? Excursions + { + get { return BackingStore?.Get("excursions"); } + set { BackingStore?.Set("excursions", value); } + } + + /// The transport property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInResponse? Transport + { + get { return BackingStore?.Get("transport"); } + set { BackingStore?.Set("transport", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipsInVacationResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "accommodation", n => { Accommodation = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInResponse.CreateFromDiscriminatorValue); } }, + { "excursions", n => { Excursions = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse.CreateFromDiscriminatorValue); } }, + { "transport", n => { Transport = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("accommodation", Accommodation); + writer.WriteObjectValue("excursions", Excursions); + writer.WriteObjectValue("transport", Transport); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..505b2ff55c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..a12fa51b7c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..52531aeba7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..006c636142 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInCreateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..ef0edc7b11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInExcursionResponse(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..d216bc05c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "accommodations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest(), + "excursions" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest(), + "transports" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest(), + "vacations" => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest(), + _ => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..e183a6abda --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..c9fb943220 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..29f2e160c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,30 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "accommodations")] + #pragma warning disable CS1591 + Accommodations, + #pragma warning restore CS1591 + [EnumMember(Value = "excursions")] + #pragma warning disable CS1591 + Excursions, + #pragma warning restore CS1591 + [EnumMember(Value = "transports")] + #pragma warning disable CS1591 + Transports, + #pragma warning restore CS1591 + [EnumMember(Value = "vacations")] + #pragma warning disable CS1591 + Vacations, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs new file mode 100644 index 0000000000..7275a54806 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/SecondaryAccommodationResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryAccommodationResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryAccommodationResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInAccommodationResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs new file mode 100644 index 0000000000..bddbf36b25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyExcursionInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyExcursionInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs new file mode 100644 index 0000000000..6f7f34c3c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToManyExcursionInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyExcursionInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyExcursionInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs new file mode 100644 index 0000000000..83491df0a3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneAccommodationInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneAccommodationInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs new file mode 100644 index 0000000000..49ca70655a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/ToOneAccommodationInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneAccommodationInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneAccommodationInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs new file mode 100644 index 0000000000..7110d5b545 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TransportCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TransportCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInTransportResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs new file mode 100644 index 0000000000..7f03dfd042 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TransportIdentifierInRequest : global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs new file mode 100644 index 0000000000..4b0075da35 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class TransportIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public TransportIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs new file mode 100644 index 0000000000..4e241e7587 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/TransportResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum TransportResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "transports")] + #pragma warning disable CS1591 + Transports, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs new file mode 100644 index 0000000000..d83d3035b0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateAccommodationRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateAccommodationRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateAccommodationRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateAccommodationRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateAccommodationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs new file mode 100644 index 0000000000..9d538a72ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateExcursionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateExcursionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateExcursionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateExcursionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateExcursionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs new file mode 100644 index 0000000000..f71ccaa8a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateTransportRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateTransportRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateTransportRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateTransportRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs new file mode 100644 index 0000000000..b579eb69af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/UpdateVacationRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateVacationRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateVacationRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInUpdateVacationRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs new file mode 100644 index 0000000000..60112bb059 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Models/VacationCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class VacationCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public VacationCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.DataInVacationResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs new file mode 100644 index 0000000000..0929e31a11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/Item/TransportsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item +{ + /// + /// Builds and executes requests for operations under \transports\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing transport by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual transport by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing transport. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing transport by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual transport by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing transport. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateTransportRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item.TransportsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item.TransportsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual transport by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing transport. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs new file mode 100644 index 0000000000..d2842e63e3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Transports/TransportsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports +{ + /// + /// Builds and executes requests for operations under \transports + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.transports.item collection + /// The identifier of the transport to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item.TransportsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.Item.TransportsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/transports{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of transports. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.TransportCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new transport. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of transports. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new transport. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateTransportRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.TransportsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Transports.TransportsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of transports. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new transport. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs new file mode 100644 index 0000000000..9927c18cdb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Accommodation/AccommodationRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\accommodation + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/accommodation{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/accommodation{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.SecondaryAccommodationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation.AccommodationRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation.AccommodationRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related accommodation of an individual vacation's accommodation relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..66cb804749 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\excursions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/excursions{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/excursions{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions.ExcursionsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions.ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related excursions of an individual vacation's excursions relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs new file mode 100644 index 0000000000..f6099731e7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Accommodation/AccommodationRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\accommodation + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/accommodation{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AccommodationRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/accommodation{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.AccommodationIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing accommodation to the accommodation relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing accommodation to the accommodation relationship of an individual vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToOneAccommodationInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation.AccommodationRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation.AccommodationRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related accommodation identity of an individual vacation's accommodation relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AccommodationRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs new file mode 100644 index 0000000000..e97a234f4a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Excursions/ExcursionsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\excursions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/excursions{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ExcursionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/excursions{?query*}", rawUrl) + { + } + + /// + /// Removes existing excursions from the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ExcursionIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing excursions to the excursions relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing excursions from the excursions relationship of an individual vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing excursions to the excursions relationship of an individual vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing excursions to the excursions relationship of an individual vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ToManyExcursionInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions.ExcursionsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions.ExcursionsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related excursion identities of an individual vacation's excursions relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ExcursionsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..1ea9cf33ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The accommodation property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation.AccommodationRequestBuilder Accommodation + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Accommodation.AccommodationRequestBuilder(PathParameters, RequestAdapter); + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions.ExcursionsRequestBuilder Excursions + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Excursions.ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The transport property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport.TransportRequestBuilder Transport + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport.TransportRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs new file mode 100644 index 0000000000..943abb0242 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Relationships/Transport/TransportRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\relationships\transport + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/transport{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/relationships/transport{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableTransportIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clears or assigns an existing transport to the transport relationship of an individual vacation. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Clears or assigns an existing transport to the transport relationship of an individual vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableToOneTransportInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport.TransportRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.Transport.TransportRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related transport identity of an individual vacation's transport relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs new file mode 100644 index 0000000000..1556b9733b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/Transport/TransportRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport +{ + /// + /// Builds and executes requests for operations under \vacations\{id}\transport + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/transport{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public TransportRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}/transport{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.NullableSecondaryTransportResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport.TransportRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport.TransportRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related transport of an individual vacation's transport relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class TransportRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs new file mode 100644 index 0000000000..a487b7f64c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/Item/VacationsItemRequestBuilder.cs @@ -0,0 +1,237 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item +{ + /// + /// Builds and executes requests for operations under \vacations\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsItemRequestBuilder : BaseRequestBuilder + { + /// The accommodation property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation.AccommodationRequestBuilder Accommodation + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Accommodation.AccommodationRequestBuilder(PathParameters, RequestAdapter); + } + + /// The excursions property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions.ExcursionsRequestBuilder Excursions + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Excursions.ExcursionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The transport property + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport.TransportRequestBuilder Transport + { + get => new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.Transport.TransportRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VacationsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VacationsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing vacation by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual vacation by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing vacation. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing vacation by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual vacation by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.UpdateVacationRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.VacationsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.VacationsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual vacation by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing vacation. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs new file mode 100644 index 0000000000..358bd9814e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/Links/GeneratedCode/Vacations/VacationsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations +{ + /// + /// Builds and executes requests for operations under \vacations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.Links.GeneratedCode.vacations.item collection + /// The identifier of the vacation to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.VacationsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.Item.VacationsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VacationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VacationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/vacations{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of vacations. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.VacationCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new vacation. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.PrimaryVacationResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of vacations. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new vacation. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Models.CreateVacationRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.VacationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.Links.GeneratedCode.Vacations.VacationsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of vacations. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new vacation. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VacationsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs new file mode 100644 index 0000000000..79e12b6fd0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ModelStateValidationClient : BaseRequestBuilder + { + /// The socialMediaAccounts property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.SocialMediaAccountsRequestBuilder SocialMediaAccounts + { + get => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.SocialMediaAccountsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public ModelStateValidationClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..16db047270 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs new file mode 100644 index 0000000000..1180b1d39a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInCreateSocialMediaAccountRequest.cs @@ -0,0 +1,213 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The age property + public double? Age + { + get { return BackingStore?.Get("age"); } + set { BackingStore?.Set("age", value); } + } + + /// The alternativeId property + public Guid? AlternativeId + { + get { return BackingStore?.Get("alternativeId"); } + set { BackingStore?.Set("alternativeId", value); } + } + + /// The backgroundPicture property + public string? BackgroundPicture + { + get { return BackingStore?.Get("backgroundPicture"); } + set { BackingStore?.Set("backgroundPicture", value); } + } + + /// The countryCode property + public string? CountryCode + { + get { return BackingStore?.Get("countryCode"); } + set { BackingStore?.Set("countryCode", value); } + } + + /// The creditCard property + public string? CreditCard + { + get { return BackingStore?.Get("creditCard"); } + set { BackingStore?.Set("creditCard", value); } + } + + /// The email property + public string? Email + { + get { return BackingStore?.Get("email"); } + set { BackingStore?.Set("email", value); } + } + + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// The nextRevalidation property + public string? NextRevalidation + { + get { return BackingStore?.Get("nextRevalidation"); } + set { BackingStore?.Set("nextRevalidation", value); } + } + + /// The password property + public byte[]? Password + { + get { return BackingStore?.Get("password"); } + set { BackingStore?.Set("password", value); } + } + + /// The phone property + public string? Phone + { + get { return BackingStore?.Get("phone"); } + set { BackingStore?.Set("phone", value); } + } + + /// The planet property + public string? Planet + { + get { return BackingStore?.Get("planet"); } + set { BackingStore?.Set("planet", value); } + } + + /// The profilePicture property + public string? ProfilePicture + { + get { return BackingStore?.Get("profilePicture"); } + set { BackingStore?.Set("profilePicture", value); } + } + + /// The tags property + public List? Tags + { + get { return BackingStore?.Get?>("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// The validatedAt property + public DateTimeOffset? ValidatedAt + { + get { return BackingStore?.Get("validatedAt"); } + set { BackingStore?.Set("validatedAt", value); } + } + + /// The validatedAtDate property + public Date? ValidatedAtDate + { + get { return BackingStore?.Get("validatedAtDate"); } + set { BackingStore?.Set("validatedAtDate", value); } + } + + /// The validatedAtTime property + public Time? ValidatedAtTime + { + get { return BackingStore?.Get("validatedAtTime"); } + set { BackingStore?.Set("validatedAtTime", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "age", n => { Age = n.GetDoubleValue(); } }, + { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, + { "backgroundPicture", n => { BackgroundPicture = n.GetStringValue(); } }, + { "countryCode", n => { CountryCode = n.GetStringValue(); } }, + { "creditCard", n => { CreditCard = n.GetStringValue(); } }, + { "email", n => { Email = n.GetStringValue(); } }, + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + { "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } }, + { "password", n => { Password = n.GetByteArrayValue(); } }, + { "phone", n => { Phone = n.GetStringValue(); } }, + { "planet", n => { Planet = n.GetStringValue(); } }, + { "profilePicture", n => { ProfilePicture = n.GetStringValue(); } }, + { "tags", n => { Tags = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "userName", n => { UserName = n.GetStringValue(); } }, + { "validatedAt", n => { ValidatedAt = n.GetDateTimeOffsetValue(); } }, + { "validatedAtDate", n => { ValidatedAtDate = n.GetDateValue(); } }, + { "validatedAtTime", n => { ValidatedAtTime = n.GetTimeValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("age", Age); + writer.WriteGuidValue("alternativeId", AlternativeId); + writer.WriteStringValue("backgroundPicture", BackgroundPicture); + writer.WriteStringValue("countryCode", CountryCode); + writer.WriteStringValue("creditCard", CreditCard); + writer.WriteStringValue("email", Email); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + writer.WriteStringValue("nextRevalidation", NextRevalidation); + writer.WriteByteArrayValue("password", Password); + writer.WriteStringValue("phone", Phone); + writer.WriteStringValue("planet", Planet); + writer.WriteStringValue("profilePicture", ProfilePicture); + writer.WriteCollectionOfPrimitiveValues("tags", Tags); + writer.WriteStringValue("userName", UserName); + writer.WriteDateTimeOffsetValue("validatedAt", ValidatedAt); + writer.WriteDateValue("validatedAtDate", ValidatedAtDate); + writer.WriteTimeValue("validatedAtTime", ValidatedAtTime); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..40ca9d3903 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs new file mode 100644 index 0000000000..68dee62e83 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInSocialMediaAccountResponse.cs @@ -0,0 +1,213 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInSocialMediaAccountResponse : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The age property + public double? Age + { + get { return BackingStore?.Get("age"); } + set { BackingStore?.Set("age", value); } + } + + /// The alternativeId property + public Guid? AlternativeId + { + get { return BackingStore?.Get("alternativeId"); } + set { BackingStore?.Set("alternativeId", value); } + } + + /// The backgroundPicture property + public string? BackgroundPicture + { + get { return BackingStore?.Get("backgroundPicture"); } + set { BackingStore?.Set("backgroundPicture", value); } + } + + /// The countryCode property + public string? CountryCode + { + get { return BackingStore?.Get("countryCode"); } + set { BackingStore?.Set("countryCode", value); } + } + + /// The creditCard property + public string? CreditCard + { + get { return BackingStore?.Get("creditCard"); } + set { BackingStore?.Set("creditCard", value); } + } + + /// The email property + public string? Email + { + get { return BackingStore?.Get("email"); } + set { BackingStore?.Set("email", value); } + } + + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// The nextRevalidation property + public string? NextRevalidation + { + get { return BackingStore?.Get("nextRevalidation"); } + set { BackingStore?.Set("nextRevalidation", value); } + } + + /// The password property + public byte[]? Password + { + get { return BackingStore?.Get("password"); } + set { BackingStore?.Set("password", value); } + } + + /// The phone property + public string? Phone + { + get { return BackingStore?.Get("phone"); } + set { BackingStore?.Set("phone", value); } + } + + /// The planet property + public string? Planet + { + get { return BackingStore?.Get("planet"); } + set { BackingStore?.Set("planet", value); } + } + + /// The profilePicture property + public string? ProfilePicture + { + get { return BackingStore?.Get("profilePicture"); } + set { BackingStore?.Set("profilePicture", value); } + } + + /// The tags property + public List? Tags + { + get { return BackingStore?.Get?>("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// The validatedAt property + public DateTimeOffset? ValidatedAt + { + get { return BackingStore?.Get("validatedAt"); } + set { BackingStore?.Set("validatedAt", value); } + } + + /// The validatedAtDate property + public Date? ValidatedAtDate + { + get { return BackingStore?.Get("validatedAtDate"); } + set { BackingStore?.Set("validatedAtDate", value); } + } + + /// The validatedAtTime property + public Time? ValidatedAtTime + { + get { return BackingStore?.Get("validatedAtTime"); } + set { BackingStore?.Set("validatedAtTime", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "age", n => { Age = n.GetDoubleValue(); } }, + { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, + { "backgroundPicture", n => { BackgroundPicture = n.GetStringValue(); } }, + { "countryCode", n => { CountryCode = n.GetStringValue(); } }, + { "creditCard", n => { CreditCard = n.GetStringValue(); } }, + { "email", n => { Email = n.GetStringValue(); } }, + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + { "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } }, + { "password", n => { Password = n.GetByteArrayValue(); } }, + { "phone", n => { Phone = n.GetStringValue(); } }, + { "planet", n => { Planet = n.GetStringValue(); } }, + { "profilePicture", n => { ProfilePicture = n.GetStringValue(); } }, + { "tags", n => { Tags = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "userName", n => { UserName = n.GetStringValue(); } }, + { "validatedAt", n => { ValidatedAt = n.GetDateTimeOffsetValue(); } }, + { "validatedAtDate", n => { ValidatedAtDate = n.GetDateValue(); } }, + { "validatedAtTime", n => { ValidatedAtTime = n.GetTimeValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("age", Age); + writer.WriteGuidValue("alternativeId", AlternativeId); + writer.WriteStringValue("backgroundPicture", BackgroundPicture); + writer.WriteStringValue("countryCode", CountryCode); + writer.WriteStringValue("creditCard", CreditCard); + writer.WriteStringValue("email", Email); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + writer.WriteStringValue("nextRevalidation", NextRevalidation); + writer.WriteByteArrayValue("password", Password); + writer.WriteStringValue("phone", Phone); + writer.WriteStringValue("planet", Planet); + writer.WriteStringValue("profilePicture", ProfilePicture); + writer.WriteCollectionOfPrimitiveValues("tags", Tags); + writer.WriteStringValue("userName", UserName); + writer.WriteDateTimeOffsetValue("validatedAt", ValidatedAt); + writer.WriteDateValue("validatedAtDate", ValidatedAtDate); + writer.WriteTimeValue("validatedAtTime", ValidatedAtTime); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..1458bf604b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs new file mode 100644 index 0000000000..76e7aead9a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/AttributesInUpdateSocialMediaAccountRequest.cs @@ -0,0 +1,213 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The age property + public double? Age + { + get { return BackingStore?.Get("age"); } + set { BackingStore?.Set("age", value); } + } + + /// The alternativeId property + public Guid? AlternativeId + { + get { return BackingStore?.Get("alternativeId"); } + set { BackingStore?.Set("alternativeId", value); } + } + + /// The backgroundPicture property + public string? BackgroundPicture + { + get { return BackingStore?.Get("backgroundPicture"); } + set { BackingStore?.Set("backgroundPicture", value); } + } + + /// The countryCode property + public string? CountryCode + { + get { return BackingStore?.Get("countryCode"); } + set { BackingStore?.Set("countryCode", value); } + } + + /// The creditCard property + public string? CreditCard + { + get { return BackingStore?.Get("creditCard"); } + set { BackingStore?.Set("creditCard", value); } + } + + /// The email property + public string? Email + { + get { return BackingStore?.Get("email"); } + set { BackingStore?.Set("email", value); } + } + + /// The firstName property + public string? FirstName + { + get { return BackingStore?.Get("firstName"); } + set { BackingStore?.Set("firstName", value); } + } + + /// The lastName property + public string? LastName + { + get { return BackingStore?.Get("lastName"); } + set { BackingStore?.Set("lastName", value); } + } + + /// The nextRevalidation property + public string? NextRevalidation + { + get { return BackingStore?.Get("nextRevalidation"); } + set { BackingStore?.Set("nextRevalidation", value); } + } + + /// The password property + public byte[]? Password + { + get { return BackingStore?.Get("password"); } + set { BackingStore?.Set("password", value); } + } + + /// The phone property + public string? Phone + { + get { return BackingStore?.Get("phone"); } + set { BackingStore?.Set("phone", value); } + } + + /// The planet property + public string? Planet + { + get { return BackingStore?.Get("planet"); } + set { BackingStore?.Set("planet", value); } + } + + /// The profilePicture property + public string? ProfilePicture + { + get { return BackingStore?.Get("profilePicture"); } + set { BackingStore?.Set("profilePicture", value); } + } + + /// The tags property + public List? Tags + { + get { return BackingStore?.Get?>("tags"); } + set { BackingStore?.Set("tags", value); } + } + + /// The userName property + public string? UserName + { + get { return BackingStore?.Get("userName"); } + set { BackingStore?.Set("userName", value); } + } + + /// The validatedAt property + public DateTimeOffset? ValidatedAt + { + get { return BackingStore?.Get("validatedAt"); } + set { BackingStore?.Set("validatedAt", value); } + } + + /// The validatedAtDate property + public Date? ValidatedAtDate + { + get { return BackingStore?.Get("validatedAtDate"); } + set { BackingStore?.Set("validatedAtDate", value); } + } + + /// The validatedAtTime property + public Time? ValidatedAtTime + { + get { return BackingStore?.Get("validatedAtTime"); } + set { BackingStore?.Set("validatedAtTime", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "age", n => { Age = n.GetDoubleValue(); } }, + { "alternativeId", n => { AlternativeId = n.GetGuidValue(); } }, + { "backgroundPicture", n => { BackgroundPicture = n.GetStringValue(); } }, + { "countryCode", n => { CountryCode = n.GetStringValue(); } }, + { "creditCard", n => { CreditCard = n.GetStringValue(); } }, + { "email", n => { Email = n.GetStringValue(); } }, + { "firstName", n => { FirstName = n.GetStringValue(); } }, + { "lastName", n => { LastName = n.GetStringValue(); } }, + { "nextRevalidation", n => { NextRevalidation = n.GetStringValue(); } }, + { "password", n => { Password = n.GetByteArrayValue(); } }, + { "phone", n => { Phone = n.GetStringValue(); } }, + { "planet", n => { Planet = n.GetStringValue(); } }, + { "profilePicture", n => { ProfilePicture = n.GetStringValue(); } }, + { "tags", n => { Tags = n.GetCollectionOfPrimitiveValues()?.AsList(); } }, + { "userName", n => { UserName = n.GetStringValue(); } }, + { "validatedAt", n => { ValidatedAt = n.GetDateTimeOffsetValue(); } }, + { "validatedAtDate", n => { ValidatedAtDate = n.GetDateValue(); } }, + { "validatedAtTime", n => { ValidatedAtTime = n.GetTimeValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("age", Age); + writer.WriteGuidValue("alternativeId", AlternativeId); + writer.WriteStringValue("backgroundPicture", BackgroundPicture); + writer.WriteStringValue("countryCode", CountryCode); + writer.WriteStringValue("creditCard", CreditCard); + writer.WriteStringValue("email", Email); + writer.WriteStringValue("firstName", FirstName); + writer.WriteStringValue("lastName", LastName); + writer.WriteStringValue("nextRevalidation", NextRevalidation); + writer.WriteByteArrayValue("password", Password); + writer.WriteStringValue("phone", Phone); + writer.WriteStringValue("planet", Planet); + writer.WriteStringValue("profilePicture", ProfilePicture); + writer.WriteCollectionOfPrimitiveValues("tags", Tags); + writer.WriteStringValue("userName", UserName); + writer.WriteDateTimeOffsetValue("validatedAt", ValidatedAt); + writer.WriteDateValue("validatedAtDate", ValidatedAtDate); + writer.WriteTimeValue("validatedAtTime", ValidatedAtTime); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs new file mode 100644 index 0000000000..0bc12dfcdb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/CreateSocialMediaAccountRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateSocialMediaAccountRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateSocialMediaAccountRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs new file mode 100644 index 0000000000..b2a9fe8fc4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInCreateSocialMediaAccountRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInCreateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs new file mode 100644 index 0000000000..5d4e2e2249 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInSocialMediaAccountResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInSocialMediaAccountResponse : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInSocialMediaAccountResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs new file mode 100644 index 0000000000..a42f2f8330 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInUpdateSocialMediaAccountRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateSocialMediaAccountRequest : global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.AttributesInUpdateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..962ad2a606 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..ae0b0f1df6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..70ecdd4e35 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..c5ad075af9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..1cfb0ac02b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..0ce479b554 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs new file mode 100644 index 0000000000..0013b483f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/PrimarySocialMediaAccountResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimarySocialMediaAccountResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimarySocialMediaAccountResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..442849bb0e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInCreateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..5984a83a76 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInSocialMediaAccountResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..5ee530f218 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "socialMediaAccounts" => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..99aeff08e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..3e05b21d48 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..ae70b7cb5d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "socialMediaAccounts")] + #pragma warning disable CS1591 + SocialMediaAccounts, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs new file mode 100644 index 0000000000..9fe2f9d8ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/UpdateSocialMediaAccountRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateSocialMediaAccountRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateSocialMediaAccountRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.DataInUpdateSocialMediaAccountRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs new file mode 100644 index 0000000000..ae98f228ee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/Item/SocialMediaAccountsItemRequestBuilder.cs @@ -0,0 +1,103 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item +{ + /// + /// Builds and executes requests for operations under \socialMediaAccounts\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SocialMediaAccountsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public SocialMediaAccountsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/socialMediaAccounts/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public SocialMediaAccountsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/socialMediaAccounts/{id}{?query*}", rawUrl) + { + } + + /// + /// Updates an existing socialMediaAccount. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing socialMediaAccount. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.UpdateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item.SocialMediaAccountsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item.SocialMediaAccountsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Updates an existing socialMediaAccount. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SocialMediaAccountsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs new file mode 100644 index 0000000000..0a35a41272 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/SocialMediaAccounts/SocialMediaAccountsRequestBuilder.cs @@ -0,0 +1,119 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts +{ + /// + /// Builds and executes requests for operations under \socialMediaAccounts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SocialMediaAccountsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.socialMediaAccounts.item collection + /// The identifier of the socialMediaAccount to update. + /// A + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item.SocialMediaAccountsItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.Item.SocialMediaAccountsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public SocialMediaAccountsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/socialMediaAccounts{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public SocialMediaAccountsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/socialMediaAccounts{?query*}", rawUrl) + { + } + + /// + /// Creates a new socialMediaAccount. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.PrimarySocialMediaAccountResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new socialMediaAccount. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models.CreateSocialMediaAccountRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.SocialMediaAccountsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts.SocialMediaAccountsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new socialMediaAccount. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SocialMediaAccountsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs new file mode 100644 index 0000000000..5a6022df63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs @@ -0,0 +1,566 @@ +using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode; +using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ModelStateValidation; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; +using IJsonApiOptions = JsonApiDotNetCore.Configuration.IJsonApiOptions; + +namespace OpenApiKiotaEndToEndTests.ModelStateValidation; + +public sealed class ModelStateValidationTests + : IClassFixture, ModelStateValidationDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ModelStateValidationDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ModelStateValidationFakers _fakers = new(); + + public ModelStateValidationTests(IntegrationTestContext, ModelStateValidationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + var options = testContext.Factory.Services.GetRequiredService(); + options.SerializerOptions.Converters.Add(new UtcDateTimeJsonConverter()); + } + + [Theory] + [InlineData("a")] + [InlineData("abcdefghijklmnopqrstu")] + public async Task Cannot_exceed_length_constraint(string firstName) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + FirstName = firstName, + LastName = newAccount.LastName + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field FirstName must be a string or collection type with a minimum length of '2' and maximum length of '20'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/firstName"); + } + + [Theory] + [InlineData("ab")] + [InlineData("abcdefghijklmnopqrs")] + public async Task Cannot_exceed_string_length_constraint(string userName) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + UserName = userName + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field UserName must be a string with a minimum length of 3 and a maximum length of 18."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/userName"); + } + + [Fact] + public async Task Cannot_violate_regular_expression_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + UserName = "aB1" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("Only letters are allowed."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/userName"); + } + + [Fact] + public async Task Cannot_use_invalid_credit_card_number() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + CreditCard = "123-456" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The CreditCard field is not a valid credit card number."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/creditCard"); + } + + [Fact] + public async Task Cannot_use_invalid_email_address() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Email = "abc" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The Email field is not a valid e-mail address."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/email"); + } + + [Fact] + public async Task Cannot_exceed_min_length_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + // Using -3 instead of -1 to compensate for base64 padding. + Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MinPasswordChars - 3).ToArray() + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + const int minCharsInBase64 = SocialMediaAccount.MinPasswordCharsInBase64; + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Password must be a string or array type with a minimum length of '{minCharsInBase64}'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/password"); + } + + [Fact] + public async Task Cannot_exceed_max_length_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MaxPasswordChars + 1).ToArray() + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + const int maxCharsInBase64 = SocialMediaAccount.MaxPasswordCharsInBase64; + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Password must be a string or array type with a maximum length of '{maxCharsInBase64}'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/password"); + } + + [Theory] + [InlineData(-1)] + [InlineData(-0.56)] + [InlineData(123.98)] + [InlineData(124)] + public async Task Cannot_use_double_outside_of_valid_range(double age) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Age = age + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Age must be between {0.1} exclusive and {122.9} exclusive."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/age"); + } + + [Fact] + public async Task Cannot_use_relative_url() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + BackgroundPicture = "relative-url" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The BackgroundPicture field is not a valid fully-qualified http, https, or ftp URL."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/backgroundPicture"); + } + + [Theory] + [InlineData(0)] + [InlineData(11)] + public async Task Cannot_exceed_collection_length_constraint(int length) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Tags = Enumerable.Repeat("-", length).ToList() + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field Tags must be a string or collection type with a minimum length of '1' and maximum length of '10'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/tags"); + } + + [Fact] + public async Task Cannot_use_non_allowed_value() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + CountryCode = "XX" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The CountryCode field does not equal any of the values specified in AllowedValuesAttribute."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/countryCode"); + } + + [Fact] + public async Task Cannot_use_denied_value() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Planet = "pluto" + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The Planet field equals one of the values specified in DeniedValuesAttribute."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/planet"); + } + + [Fact] + public async Task Cannot_use_TimeSpan_outside_of_valid_range() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + NextRevalidation = TimeSpan.FromSeconds(1).ToString() + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync()).Which; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field NextRevalidation must be between 01:00:00 and 05:00:00."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/nextRevalidation"); + } + + [Fact] + public async Task Can_create_resource_with_valid_properties() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + ModelStateValidationClient apiClient = new(requestAdapter); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Type = ResourceType.SocialMediaAccounts, + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + AlternativeId = newAccount.AlternativeId, + FirstName = newAccount.FirstName, + LastName = newAccount.LastName, + UserName = newAccount.UserName, + CreditCard = newAccount.CreditCard, + Email = newAccount.Email, + Password = Convert.FromBase64String(newAccount.Password!), + Phone = newAccount.Phone, + Age = newAccount.Age, + ProfilePicture = newAccount.ProfilePicture!.ToString(), + BackgroundPicture = newAccount.BackgroundPicture, + Tags = newAccount.Tags, + CountryCode = newAccount.CountryCode, + Planet = newAccount.Planet, + NextRevalidation = newAccount.NextRevalidation!.Value.ToString(), + ValidatedAt = newAccount.ValidatedAt!, + ValidatedAtDate = newAccount.ValidatedAtDate!.Value, + ValidatedAtTime = newAccount.ValidatedAtTime!.Value + } + } + }; + + // Act + Func action = () => apiClient.SocialMediaAccounts.PostAsync(requestBody); + + // Assert + await action.Should().NotThrowAsync(); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs new file mode 100644 index 0000000000..d4d22fa27e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs @@ -0,0 +1,18 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OpenApiKiotaEndToEndTests.ModelStateValidation; + +internal sealed class UtcDateTimeJsonConverter : JsonConverter +{ + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + DateTimeOffset dateTimeOffset = DateTimeOffset.Parse(reader.GetString()!); + return dateTimeOffset.UtcDateTime; + } + + public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.ToUniversalTime().ToString("O")); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj new file mode 100644 index 0000000000..ca0db62217 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/OpenApiKiotaEndToEndTests.csproj @@ -0,0 +1,108 @@ + + + net9.0 + + + + + + + + + + + + + + + + + + + + + + + + AtomicOperations + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ClientIdGenerationModes + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + Headers + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + Links + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ModelStateValidation + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + QueryStrings + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + NoOperations + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + OnlyRelationships + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + SubsetOfOperations + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + ResourceInheritance + SubsetOfVarious + $(MSBuildProjectName).%(Subcategory).%(Name).GeneratedCode + %(Name)InheritanceClient + ./%(Subcategory)/%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + RestrictedControllers + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + ./%(Name)/GeneratedCode + $(JsonApiExtraArguments) + + + diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/FilterTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/FilterTests.cs new file mode 100644 index 0000000000..d5de6f1696 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/FilterTests.cs @@ -0,0 +1,183 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.QueryStrings; + +public sealed class FilterTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly QueryStringFakers _fakers = new(); + + public FilterTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_filter_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(2); + nodes[0].Name = "John No Quote"; + nodes[1].Name = "Brian O'Quote"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["filter"] = "equals(name,'Brian O''Quote')" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(nodes[1].Name); + attributes.Comment.Should().Be(nodes[1].Comment); + }); + + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(1); + } + + [Fact] + public async Task Can_filter_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Comment = "Discount: $10"; + node.Children.ElementAt(1).Comment = "Discount: 5%"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["filter"] = "and(startsWith(comment,'Discount:'),contains(comment,'%'))" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(node.Children.ElementAt(1).Name); + attributes.Comment.Should().Be(node.Children.ElementAt(1).Comment); + }); + + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(1); + } + + [Fact] + public async Task Can_filter_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Children = _fakers.Node.GenerateSet(1); + node.Children.ElementAt(1).Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["filter"] = "greaterThan(count(children),'1')" + }); + + // Act + NodeIdentifierCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Relationships.Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(1); + response.Links.Should().NotBeNull(); + response.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); + } + + [Fact] + public async Task Cannot_use_empty_filter() + { + // Arrange + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["filter"] = null + }); + + // Act + Func action = async () => _ = await apiClient.Nodes[Unknown.StringId.Int64].GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Links.Should().NotBeNull(); + exception.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors[0]; + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'filter' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("filter"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs new file mode 100644 index 0000000000..83e852a185 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNameValuePairRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The value property + public string? Value + { + get { return BackingStore?.Get("value"); } + set { BackingStore?.Set("value", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "value", n => { Value = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("value", Value); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs new file mode 100644 index 0000000000..429463d2a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateNodeRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The comment property + public string? Comment + { + get { return BackingStore?.Get("comment"); } + set { BackingStore?.Set("comment", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "comment", n => { Comment = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("comment", Comment); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..31ce729c77 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs new file mode 100644 index 0000000000..5e691ca747 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNameValuePairResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The value property + public string? Value + { + get { return BackingStore?.Get("value"); } + set { BackingStore?.Set("value", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "value", n => { Value = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("value", Value); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs new file mode 100644 index 0000000000..cff20802c5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInNodeResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The comment property + public string? Comment + { + get { return BackingStore?.Get("comment"); } + set { BackingStore?.Set("comment", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "comment", n => { Comment = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("comment", Comment); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..a74152cdd6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs new file mode 100644 index 0000000000..3979d32d08 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNameValuePairRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// The value property + public string? Value + { + get { return BackingStore?.Get("value"); } + set { BackingStore?.Set("value", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + { "value", n => { Value = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + writer.WriteStringValue("value", Value); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs new file mode 100644 index 0000000000..2dcd9bd224 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateNodeRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The comment property + public string? Comment + { + get { return BackingStore?.Get("comment"); } + set { BackingStore?.Set("comment", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "comment", n => { Comment = n.GetStringValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("comment", Comment); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..41597dd5fb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs new file mode 100644 index 0000000000..b72cc6bd95 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNameValuePairRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateNameValuePairRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateNameValuePairRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs new file mode 100644 index 0000000000..c9489c5c67 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/CreateNodeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateNodeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateNodeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs new file mode 100644 index 0000000000..6214682931 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNameValuePairRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs new file mode 100644 index 0000000000..48e6bfc6b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInCreateNodeRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInCreateNodeRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs new file mode 100644 index 0000000000..4d1dd05d94 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNameValuePairResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNameValuePairResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs new file mode 100644 index 0000000000..297d9072eb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInNodeResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInNodeResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs new file mode 100644 index 0000000000..fb123dff1b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNameValuePairRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs new file mode 100644 index 0000000000..b2856cc56c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/DataInUpdateNodeRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.AttributesInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..1b81137154 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..a77ce1b055 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..3a149be5b1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..e5798125f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..97094d84f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..40554d6177 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..8f63438119 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs new file mode 100644 index 0000000000..8f0ed84c22 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NameValuePairCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NameValuePairCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..3191d5c9b9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NameValuePairIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NameValuePairIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs new file mode 100644 index 0000000000..f26a216168 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NameValuePairIdentifierInRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs new file mode 100644 index 0000000000..b60d4e791c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NameValuePairIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NameValuePairIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairResourceType.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairResourceType.cs new file mode 100644 index 0000000000..b38d5fe09d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NameValuePairResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum NameValuePairResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "nameValuePairs")] + #pragma warning disable CS1591 + NameValuePairs, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs new file mode 100644 index 0000000000..ed17d2fb0a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NodeCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NodeCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..ccc5cc5ac0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NodeIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NodeIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs new file mode 100644 index 0000000000..bf3423dfc8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NodeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs new file mode 100644 index 0000000000..9c02cc83e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NodeIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NodeIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs new file mode 100644 index 0000000000..36b8fd7a09 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NodeIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NodeIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeResourceType.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeResourceType.cs new file mode 100644 index 0000000000..42c31c0a7c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NodeResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum NodeResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "nodes")] + #pragma warning disable CS1591 + Nodes, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs new file mode 100644 index 0000000000..32b0161cfe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableNodeIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableNodeIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableNodeIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs new file mode 100644 index 0000000000..d29a252b19 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableSecondaryNodeResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableSecondaryNodeResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableSecondaryNodeResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs new file mode 100644 index 0000000000..876627be18 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneNodeInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneNodeInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs new file mode 100644 index 0000000000..26282c294b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/NullableToOneNodeInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneNodeInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneNodeInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs new file mode 100644 index 0000000000..e2e0a23b1c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNameValuePairResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryNameValuePairResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryNameValuePairResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs new file mode 100644 index 0000000000..2bcbbde79d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/PrimaryNodeResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryNodeResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryNodeResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..04cb85e4f0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs new file mode 100644 index 0000000000..e2fca0c85a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNameValuePairRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The owner property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("owner", Owner); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs new file mode 100644 index 0000000000..440c5a1a67 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateNodeRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The children property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest? Children + { + get { return BackingStore?.Get("children"); } + set { BackingStore?.Set("children", value); } + } + + /// The parent property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest? Parent + { + get { return BackingStore?.Get("parent"); } + set { BackingStore?.Set("parent", value); } + } + + /// The values property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest? Values + { + get { return BackingStore?.Get("values"); } + set { BackingStore?.Set("values", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest.CreateFromDiscriminatorValue); } }, + { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest.CreateFromDiscriminatorValue); } }, + { "values", n => { Values = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("children", Children); + writer.WriteObjectValue("parent", Parent); + writer.WriteObjectValue("values", Values); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..9abf8566da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs new file mode 100644 index 0000000000..fc77dd9aa1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNameValuePairResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInNameValuePairResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The owner property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("owner", Owner); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs new file mode 100644 index 0000000000..685406b888 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInNodeResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInNodeResponse : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The children property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse? Children + { + get { return BackingStore?.Get("children"); } + set { BackingStore?.Set("children", value); } + } + + /// The parent property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInResponse? Parent + { + get { return BackingStore?.Get("parent"); } + set { BackingStore?.Set("parent", value); } + } + + /// The values property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInResponse? Values + { + get { return BackingStore?.Get("values"); } + set { BackingStore?.Set("values", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse.CreateFromDiscriminatorValue); } }, + { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInResponse.CreateFromDiscriminatorValue); } }, + { "values", n => { Values = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("children", Children); + writer.WriteObjectValue("parent", Parent); + writer.WriteObjectValue("values", Values); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..65b7ac3e6a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs new file mode 100644 index 0000000000..488ff75aee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNameValuePairRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateNameValuePairRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The owner property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest? Owner + { + get { return BackingStore?.Get("owner"); } + set { BackingStore?.Set("owner", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "owner", n => { Owner = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("owner", Owner); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs new file mode 100644 index 0000000000..bc58cc23b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateNodeRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateNodeRequest : global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The children property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest? Children + { + get { return BackingStore?.Get("children"); } + set { BackingStore?.Set("children", value); } + } + + /// The parent property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest? Parent + { + get { return BackingStore?.Get("parent"); } + set { BackingStore?.Set("parent", value); } + } + + /// The values property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest? Values + { + get { return BackingStore?.Get("values"); } + set { BackingStore?.Set("values", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "children", n => { Children = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest.CreateFromDiscriminatorValue); } }, + { "parent", n => { Parent = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest.CreateFromDiscriminatorValue); } }, + { "values", n => { Values = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("children", Children); + writer.WriteObjectValue("parent", Parent); + writer.WriteObjectValue("values", Values); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..b3aafacc11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,76 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..0c8f5216aa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..c9627a36f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..03fb12891e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..6d451530ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInCreateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..ac2165ae82 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNameValuePairResponse(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..40a5b9dcc0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,85 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "nameValuePairs" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest(), + "nodes" => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest(), + _ => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..c3ae0a3daa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..9e454942fe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..b1d2f918b0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "nameValuePairs")] + #pragma warning disable CS1591 + NameValuePairs, + #pragma warning restore CS1591 + [EnumMember(Value = "nodes")] + #pragma warning disable CS1591 + Nodes, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs new file mode 100644 index 0000000000..684c5459c3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/SecondaryNodeResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryNodeResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryNodeResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInNodeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs new file mode 100644 index 0000000000..ae84aa2be2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyNameValuePairInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyNameValuePairInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs new file mode 100644 index 0000000000..661bf211ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNameValuePairInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyNameValuePairInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyNameValuePairInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs new file mode 100644 index 0000000000..d3c3da6b00 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyNodeInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyNodeInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs new file mode 100644 index 0000000000..81c8be374e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToManyNodeInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyNodeInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyNodeInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs new file mode 100644 index 0000000000..caaf390dc2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneNodeInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneNodeInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs new file mode 100644 index 0000000000..4c22e1a2be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/ToOneNodeInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneNodeInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneNodeInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs new file mode 100644 index 0000000000..b5533b51f4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNameValuePairRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateNameValuePairRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateNameValuePairRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNameValuePairRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs new file mode 100644 index 0000000000..090d6f4a8c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Models/UpdateNodeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateNodeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateNodeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.DataInUpdateNodeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs new file mode 100644 index 0000000000..01e6a4b666 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/NameValuePairsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item +{ + /// + /// Builds and executes requests for operations under \nameValuePairs\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsItemRequestBuilder : BaseRequestBuilder + { + /// The owner property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner.OwnerRequestBuilder Owner + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner.OwnerRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public NameValuePairsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public NameValuePairsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing nameValuePair by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual nameValuePair by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing nameValuePair. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing nameValuePair by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual nameValuePair by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing nameValuePair. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNameValuePairRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.NameValuePairsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.NameValuePairsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual nameValuePair by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing nameValuePair. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Owner/OwnerRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Owner/OwnerRequestBuilder.cs new file mode 100644 index 0000000000..0c1b7a4ad9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Owner/OwnerRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner +{ + /// + /// Builds and executes requests for operations under \nameValuePairs\{id}\owner + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/owner{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/owner{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related node of an individual nameValuePair's owner relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.SecondaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related node of an individual nameValuePair's owner relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner.OwnerRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Owner.OwnerRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related node of an individual nameValuePair's owner relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/Owner/OwnerRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/Owner/OwnerRequestBuilder.cs new file mode 100644 index 0000000000..f0df923e59 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/Owner/OwnerRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner +{ + /// + /// Builds and executes requests for operations under \nameValuePairs\{id}\relationships\owner + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/relationships/owner{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OwnerRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/relationships/owner{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related node identity of an individual nameValuePair's owner relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing node to the owner relationship of an individual nameValuePair. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related node identity of an individual nameValuePair's owner relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing node to the owner relationship of an individual nameValuePair. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToOneNodeInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner.OwnerRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner.OwnerRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related node identity of an individual nameValuePair's owner relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OwnerRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..b93bb6eb8d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \nameValuePairs\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The owner property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner.OwnerRequestBuilder Owner + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.Relationships.Owner.OwnerRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/NameValuePairsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/NameValuePairsRequestBuilder.cs new file mode 100644 index 0000000000..4aa6e73ee1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/NameValuePairs/NameValuePairsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs +{ + /// + /// Builds and executes requests for operations under \nameValuePairs + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.nameValuePairs.item collection + /// The identifier of the nameValuePair to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.NameValuePairsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.Item.NameValuePairsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public NameValuePairsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public NameValuePairsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nameValuePairs{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of nameValuePairs. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new nameValuePair. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNameValuePairResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of nameValuePairs. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new nameValuePair. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNameValuePairRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.NameValuePairsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.NameValuePairsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of nameValuePairs. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new nameValuePair. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NameValuePairsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Children/ChildrenRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Children/ChildrenRequestBuilder.cs new file mode 100644 index 0000000000..530deaaa1c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Children/ChildrenRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\children + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ChildrenRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/children{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ChildrenRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/children{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related nodes of an individual node's children relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related nodes of an individual node's children relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children.ChildrenRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children.ChildrenRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related nodes of an individual node's children relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/NodesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/NodesItemRequestBuilder.cs new file mode 100644 index 0000000000..6c0219db29 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/NodesItemRequestBuilder.cs @@ -0,0 +1,237 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item +{ + /// + /// Builds and executes requests for operations under \nodes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesItemRequestBuilder : BaseRequestBuilder + { + /// The children property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children.ChildrenRequestBuilder Children + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Children.ChildrenRequestBuilder(PathParameters, RequestAdapter); + } + + /// The parent property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent.ParentRequestBuilder Parent + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent.ParentRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The values property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values.ValuesRequestBuilder Values + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values.ValuesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public NodesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public NodesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing node by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual node by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing node. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing node by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual node by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.UpdateNodeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.NodesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.NodesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual node by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing node. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Parent/ParentRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Parent/ParentRequestBuilder.cs new file mode 100644 index 0000000000..92f0ca7e02 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Parent/ParentRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\parent + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ParentRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/parent{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ParentRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/parent{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related node of an individual node's parent relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableSecondaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related node of an individual node's parent relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent.ParentRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Parent.ParentRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related node of an individual node's parent relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Children/ChildrenRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Children/ChildrenRequestBuilder.cs new file mode 100644 index 0000000000..ccc60c94e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Children/ChildrenRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\relationships\children + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ChildrenRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/children{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ChildrenRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/children{?query*}", rawUrl) + { + } + + /// + /// Removes existing nodes from the children relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related node identities of an individual node's children relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing nodes to the children relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing nodes to the children relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing nodes from the children relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related node identities of an individual node's children relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing nodes to the children relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing nodes to the children relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNodeInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children.ChildrenRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children.ChildrenRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related node identities of an individual node's children relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ChildrenRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Parent/ParentRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Parent/ParentRequestBuilder.cs new file mode 100644 index 0000000000..615942d349 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Parent/ParentRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\relationships\parent + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ParentRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/parent{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ParentRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/parent{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related node identity of an individual node's parent relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableNodeIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clears or assigns an existing node to the parent relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related node identity of an individual node's parent relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Clears or assigns an existing node to the parent relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NullableToOneNodeInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent.ParentRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent.ParentRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related node identity of an individual node's parent relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ParentRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c7c1b3238a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The children property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children.ChildrenRequestBuilder Children + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Children.ChildrenRequestBuilder(PathParameters, RequestAdapter); + } + + /// The parent property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent.ParentRequestBuilder Parent + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Parent.ParentRequestBuilder(PathParameters, RequestAdapter); + } + + /// The values property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values.ValuesRequestBuilder Values + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values.ValuesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Values/ValuesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Values/ValuesRequestBuilder.cs new file mode 100644 index 0000000000..8f7da24dc4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Relationships/Values/ValuesRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\relationships\values + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ValuesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/values{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ValuesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/relationships/values{?query*}", rawUrl) + { + } + + /// + /// Removes existing nameValuePairs from the values relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related nameValuePair identities of an individual node's values relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing nameValuePairs to the values relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing nameValuePairs to the values relationship of an individual node. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing nameValuePairs from the values relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related nameValuePair identities of an individual node's values relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing nameValuePairs to the values relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing nameValuePairs to the values relationship of an individual node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ToManyNameValuePairInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values.ValuesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Relationships.Values.ValuesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related nameValuePair identities of an individual node's values relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Values/ValuesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Values/ValuesRequestBuilder.cs new file mode 100644 index 0000000000..93d0afad2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/Item/Values/ValuesRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values +{ + /// + /// Builds and executes requests for operations under \nodes\{id}\values + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ValuesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/values{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ValuesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes/{id}/values{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related nameValuePairs of an individual node's values relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NameValuePairCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related nameValuePairs of an individual node's values relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values.ValuesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.Values.ValuesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related nameValuePairs of an individual node's values relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ValuesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/NodesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/NodesRequestBuilder.cs new file mode 100644 index 0000000000..e5f1ddec6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/Nodes/NodesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes +{ + /// + /// Builds and executes requests for operations under \nodes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.nodes.item collection + /// The identifier of the node to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.NodesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.Item.NodesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public NodesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public NodesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/nodes{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of nodes. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.NodeCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new node. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.PrimaryNodeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of nodes. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new node. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models.CreateNodeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.NodesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.NodesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of nodes. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new node. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NodesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/QueryStringsClient.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/QueryStringsClient.cs new file mode 100644 index 0000000000..509ff5803b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/GeneratedCode/QueryStringsClient.cs @@ -0,0 +1,61 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class QueryStringsClient : BaseRequestBuilder + { + /// The nameValuePairs property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.NameValuePairsRequestBuilder NameValuePairs + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.NameValuePairs.NameValuePairsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The nodes property + public global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.NodesRequestBuilder Nodes + { + get => new global::OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Nodes.NodesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public QueryStringsClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs new file mode 100644 index 0000000000..0b1276b5ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/IncludeTests.cs @@ -0,0 +1,210 @@ +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.QueryStrings; + +public sealed class IncludeTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly QueryStringFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + testContext.UseController(); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "values.owner" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.StringId); + + response.Included.Should().HaveCount(2); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(1).StringId); + } + + [Fact] + public async Task Can_include_in_primary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(1); + node.Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "children.parent,values" + }); + + // Act + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.StringId); + + response.Included.Should().HaveCount(3); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values[0].StringId); + } + + [Fact] + public async Task Can_include_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "owner.parent,owner.values" + }); + + // Act + NameValuePairCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Values.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Included.Should().HaveCount(2); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.StringId); + } + + [Fact] + public async Task Can_include_in_secondary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + node.Parent.Parent = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "parent.parent" + }); + + // Act + NullableSecondaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.Parent.StringId); + + response.Included.Should().HaveCount(1); + + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.Parent.StringId).Subject.With(include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.Name.Should().Be(node.Parent.Parent.Name); + }); + } + + [Fact] + public async Task Can_use_empty_include() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = null + }); + + // Act + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.StringId); + + response.Included.Should().BeEmpty(); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/PaginationTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/PaginationTests.cs new file mode 100644 index 0000000000..8fcd76a0c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/PaginationTests.cs @@ -0,0 +1,192 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.QueryStrings; + +public sealed class PaginationTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly QueryStringFakers _fakers = new(); + + public PaginationTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_paginate_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["page[size]"] = "1", + ["page[number]"] = "2" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Can_paginate_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["page[size]"] = "2", + ["page[number]"] = "1" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Can_paginate_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["page[size]"] = "2", + ["page[number]"] = "2" + }); + + // Act + NodeIdentifierCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Relationships.Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(2).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.AdditionalData.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Cannot_use_empty_page_size() + { + // Arrange + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["page[size]"] = null + }); + + // Act + Func action = async () => _ = await apiClient.Nodes[Unknown.StringId.Int64].GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'page[size]' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("page[size]"); + } + + [Fact] + public async Task Cannot_use_empty_page_number() + { + // Arrange + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["page[number]"] = null + }); + + // Act + Func action = async () => _ = await apiClient.Nodes[Unknown.StringId.Int64].GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'page[number]' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("page[number]"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/SortTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/SortTests.cs new file mode 100644 index 0000000000..477164531a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/SortTests.cs @@ -0,0 +1,162 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.QueryStrings; + +public sealed class SortTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly QueryStringFakers _fakers = new(); + + public SortTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_sort_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(2); + nodes[0].Name = "A"; + nodes[1].Name = "B"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["sort"] = "-name" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + response.Data.ElementAt(1).Id.Should().Be(nodes[0].StringId); + } + + [Fact] + public async Task Can_sort_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Name = "B"; + node.Children.ElementAt(1).Name = "A"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["sort"] = "name" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(0).StringId); + } + + [Fact] + public async Task Can_sort_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Children = _fakers.Node.GenerateSet(1); + node.Children.ElementAt(1).Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["sort"] = "count(children)" + }); + + // Act + NodeIdentifierCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Relationships.Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(1).StringId); + } + + [Fact] + public async Task Cannot_use_empty_sort() + { + // Arrange + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["sort"] = null + }); + + // Act + Func action = async () => _ = await apiClient.Nodes[Unknown.StringId.Int64].GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'sort' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("sort"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs b/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs new file mode 100644 index 0000000000..f2d76023f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/QueryStrings/SparseFieldSetTests.cs @@ -0,0 +1,214 @@ +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiKiotaEndToEndTests.QueryStrings.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.QueryStrings; + +public sealed class SparseFieldSetTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly QueryStringFakers _fakers = new(); + + public SparseFieldSetTests(IntegrationTestContext, QueryStringDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_select_attribute_in_primary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["fields[nodes]"] = "name" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(node.Name); + attributes.Comment.Should().BeNull(); + }); + + response.Data.ElementAt(0).Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_select_fields_in_primary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["fields[nodes]"] = "comment,parent" + }); + + // Act + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().BeNull(); + response.Data.Attributes.Comment.Should().Be(node.Comment); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.Parent.Should().NotBeNull(); + response.Data.Relationships.Children.Should().BeNull(); + } + + [Fact] + public async Task Can_select_fields_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["fields[nodes]"] = "comment,children" + }); + + // Act + NodeCollectionResponseDocument? response = await apiClient.Nodes[node.StringId!].Children.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().BeNull(); + attributes.Comment.Should().Be(node.Children.ElementAt(0).Comment); + }); + + response.Data.ElementAt(0).Relationships.RefShould().NotBeNull().And.Subject.With(relationships => + { + relationships.Parent.Should().BeNull(); + relationships.Children.Should().NotBeNull(); + }); + } + + [Fact] + public async Task Can_select_fields_in_secondary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["fields[nodes]"] = "comment,children" + }); + + // Act + NullableSecondaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].Parent.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.Parent.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().BeNull(); + response.Data.Attributes.Comment.Should().Be(node.Parent.Comment); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.Parent.Should().BeNull(); + response.Data.Relationships.Children.Should().NotBeNull(); + } + + [Fact] + public async Task Can_select_empty_fieldset() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new QueryStringsClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["fields[nodes]"] = null + }); + + // Act + PrimaryNodeResponseDocument? response = await apiClient.Nodes[node.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.StringId); + response.Data.Attributes.Should().BeNull(); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs new file mode 100644 index 0000000000..34608e41f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms +{ + /// + /// Builds and executes requests for operations under \bathrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.bathrooms.item collection + /// The identifier of the bathroom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of bathrooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new bathroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of bathrooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of bathrooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new bathroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..7bad7a5678 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing bathroom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing bathroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing bathroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual bathroom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing bathroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3b90f465c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..1a54eff2ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..33d9f5449c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bathrooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs new file mode 100644 index 0000000000..1840a6c635 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms +{ + /// + /// Builds and executes requests for operations under \bedrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.bedrooms.item collection + /// The identifier of the bedroom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of bedrooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new bedroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of bedrooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of bedrooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new bedroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..57973ce98f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing bedroom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing bedroom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing bedroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual bedroom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing bedroom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..598e388d8a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..d29f2e5942 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..6135d54b25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Bedrooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..a7b82a36b4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings +{ + /// + /// Builds and executes requests for operations under \buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.buildings.item collection + /// The identifier of the building to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of buildings. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of buildings. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of buildings. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs new file mode 100644 index 0000000000..21def4f450 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item +{ + /// + /// Builds and executes requests for operations under \buildings\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing building by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual building by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing building by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual building by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual building by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs new file mode 100644 index 0000000000..33f67a3fc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths +{ + /// + /// Builds and executes requests for operations under \cyclePaths + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.cyclePaths.item collection + /// The identifier of the cyclePath to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of cyclePaths. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new cyclePath. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of cyclePaths. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new cyclePath. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of cyclePaths. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new cyclePath. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs new file mode 100644 index 0000000000..04478d64d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item +{ + /// + /// Builds and executes requests for operations under \cyclePaths\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing cyclePath by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing cyclePath. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing cyclePath. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing cyclePath. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..84fde078ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.districts.item collection + /// The identifier of the district to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new district. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of districts. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new district. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..97697a878c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/buildings{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related buildings of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs new file mode 100644 index 0000000000..a53f46f4cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs @@ -0,0 +1,230 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item +{ + /// + /// Builds and executes requests for operations under \districts\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing district by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual district by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing district. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing district by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual district by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual district by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing district. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..4748494921 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", rawUrl) + { + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..4d174d56d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..99cbc09bde --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", rawUrl) + { + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..634873f4be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Districts/Item/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/roads{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.Item.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related roads of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..74cc7fcfec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of familyHomes. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new familyHome. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of familyHomes. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of familyHomes. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new familyHome. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..5cd86b9293 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing familyHome by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing familyHome. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing familyHome by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual familyHome by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing familyHome. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..07f1485722 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..ec7dc70718 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..1bff7a15bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/FamilyHomes/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs new file mode 100644 index 0000000000..c333387544 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item +{ + /// + /// Builds and executes requests for operations under \kitchens\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing kitchen by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing kitchen. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing kitchen by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual kitchen by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing kitchen. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c4e1dd41e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..518743a34d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..3aeba693c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs new file mode 100644 index 0000000000..9550379dbc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Kitchens/KitchensRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens +{ + /// + /// Builds and executes requests for operations under \kitchens + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.kitchens.item collection + /// The identifier of the kitchen to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of kitchens. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new kitchen. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of kitchens. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of kitchens. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new kitchen. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..707839f5b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing livingRoom by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing livingRoom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing livingRoom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual livingRoom by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing livingRoom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..f94fee1287 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..04baa480d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..94c62f4484 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs new file mode 100644 index 0000000000..fd88e306a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms +{ + /// + /// Builds and executes requests for operations under \livingRooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.livingRooms.item collection + /// The identifier of the livingRoom to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of livingRooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new livingRoom. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of livingRooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of livingRooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new livingRoom. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs new file mode 100644 index 0000000000..9f2408c428 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs @@ -0,0 +1,230 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item +{ + /// + /// Builds and executes requests for operations under \mansions\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing mansion by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing mansion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing mansion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual mansion by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing mansion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..0a490103df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..096d7a183e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..219198b689 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", rawUrl) + { + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..e14200cf8e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..6215a14033 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/Item/Staff/StaffRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/staff{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMembers of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs new file mode 100644 index 0000000000..1230c0f5ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Mansions/MansionsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions +{ + /// + /// Builds and executes requests for operations under \mansions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.mansions.item collection + /// The identifier of the mansion to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of mansions. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new mansion. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of mansions. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of mansions. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new mansion. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..6a330e8052 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..72c6061598 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..f475aa09f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..52408928f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..0d95aa7196 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs new file mode 100644 index 0000000000..301d794d42 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs new file mode 100644 index 0000000000..8d75a4efec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..cc34a8ab0a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..a94f35bd20 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateCyclePathRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs new file mode 100644 index 0000000000..8eef5f29d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateDistrictRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..097c47099b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs new file mode 100644 index 0000000000..60f83f5faa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..99d12264dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..fda98370a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..250635de7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..4978f20cd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs new file mode 100644 index 0000000000..151bb6cf5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoadRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs new file mode 100644 index 0000000000..3d0a9e66af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs new file mode 100644 index 0000000000..c931b12b05 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateStaffMemberRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs new file mode 100644 index 0000000000..ce7a9e34f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs new file mode 100644 index 0000000000..dd71a1b1db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInCyclePathResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs new file mode 100644 index 0000000000..edcee26109 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInDistrictResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..47c1fb3b50 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..4dcf0cc6a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..da11af8e85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..a7f35ef114 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..071cb0e9ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..5ac3043709 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs new file mode 100644 index 0000000000..353d2b3cac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoadResponse.cs @@ -0,0 +1,64 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..29a8fe49b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs new file mode 100644 index 0000000000..3fe18d992a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInStaffMemberResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..c754bda18d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..4d46869958 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..c8534337f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..cbb1f2ce16 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..b12f5019e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateCyclePathRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..46b958d283 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateDistrictRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..afb9ac9543 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..0420a8da2e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..39140a4f6e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..50c0ba0f0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..15c7d4374e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..273f263669 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs new file mode 100644 index 0000000000..a936222f15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoadRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs new file mode 100644 index 0000000000..3f22f9b402 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs new file mode 100644 index 0000000000..d378d79f6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateStaffMemberRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs new file mode 100644 index 0000000000..97e23c3a87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/AttributesInUpdateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs new file mode 100644 index 0000000000..22ac6bbbb0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BathroomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..aeeb9c4ec9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..b05115519b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs new file mode 100644 index 0000000000..a1b8258f5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BedroomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..26d6bdc060 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..e6084ade45 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs new file mode 100644 index 0000000000..de70d18e6c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..94835279fc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..4fd807029f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..9f6d930774 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..96359f1803 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs new file mode 100644 index 0000000000..8cce0e4061 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBathroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBathroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBathroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBathroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs new file mode 100644 index 0000000000..f413f2ce22 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBedroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBedroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBedroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBedroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs new file mode 100644 index 0000000000..7976336947 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs new file mode 100644 index 0000000000..efca2efb7f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateCyclePathRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateCyclePathRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateCyclePathRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateCyclePathRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs new file mode 100644 index 0000000000..d14a96477d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateDistrictRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateDistrictRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateDistrictRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateDistrictRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs new file mode 100644 index 0000000000..d1856d8858 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateFamilyHomeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateFamilyHomeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateFamilyHomeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateFamilyHomeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs new file mode 100644 index 0000000000..cd810b9ba4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateKitchenRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateKitchenRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateKitchenRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateKitchenRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs new file mode 100644 index 0000000000..f2299f2581 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateLivingRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateLivingRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateLivingRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateLivingRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs new file mode 100644 index 0000000000..bb29334949 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateMansionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateMansionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateMansionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateMansionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs new file mode 100644 index 0000000000..7c58e8cb68 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateResidenceRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateResidenceRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateResidenceRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs new file mode 100644 index 0000000000..5e63e19af7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoadRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoadRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateRoadRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs new file mode 100644 index 0000000000..865ecfe4e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs new file mode 100644 index 0000000000..2c1cbf0b3e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateStaffMemberRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateStaffMemberRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateStaffMemberRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs new file mode 100644 index 0000000000..f8cf45bef2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CreateToiletRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateToiletRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateToiletRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs new file mode 100644 index 0000000000..b0f928ca37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CyclePathCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs new file mode 100644 index 0000000000..9bb5f6097b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..eeec76d0cf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..3e623201a9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..d4fb16318a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..cec5c7d131 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs new file mode 100644 index 0000000000..655cc0881a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs new file mode 100644 index 0000000000..efb696ec11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..f0f2d916b4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..308bc4facb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs new file mode 100644 index 0000000000..77a20888c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateDistrictRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..edd88ebba0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs new file mode 100644 index 0000000000..441eceef39 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..6c65cfb4f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..07f8a426a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..a58ad49e5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs new file mode 100644 index 0000000000..37c37f4572 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoadRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs new file mode 100644 index 0000000000..3fd3ee76d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs new file mode 100644 index 0000000000..8034b3e20d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateStaffMemberRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInCreateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs new file mode 100644 index 0000000000..abcd4e2074 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs new file mode 100644 index 0000000000..366e871404 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs new file mode 100644 index 0000000000..9379e911da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInDistrictResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..4e6eee24ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..f2f0ef9ac3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..3f28800e7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..b729a9fde1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..75f1ed93b9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs new file mode 100644 index 0000000000..e9fdc4ae57 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoadResponse.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoadResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..bcacceacf5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs new file mode 100644 index 0000000000..0581fecac2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInStaffMemberResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..078ebec90c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..1c21c30ada --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..100afbc623 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..a665515864 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..640b86b7d9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..6c0c9ae9fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateDistrictRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..0e72321271 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..8e8ecb22ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..a01946a0ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..963601d149 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..227dc7e5c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs new file mode 100644 index 0000000000..dbdc255dd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoadRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs new file mode 100644 index 0000000000..6d768ab716 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateRoomRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs new file mode 100644 index 0000000000..4244f65037 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateStaffMemberRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateStaffMemberRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AttributesInUpdateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs new file mode 100644 index 0000000000..7525a6c1be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DataInUpdateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs new file mode 100644 index 0000000000..7766139356 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/DistrictCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DistrictCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..d476e9cda8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..5dd14b1cdd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..ac5ec03ee8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..3bac05fc46 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..0e310de4e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs new file mode 100644 index 0000000000..6b2bf04584 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public FamilyHomeCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..e0b5fc07e5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..ba86f418d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..1fdd61d52f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,96 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs new file mode 100644 index 0000000000..1380ce2f96 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public KitchenCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..f1da5bb35a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..ba4007e42f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs new file mode 100644 index 0000000000..701925f556 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public LivingRoomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..4f89cfa7fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..6cadc432df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs new file mode 100644 index 0000000000..eb8354866f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..d538d1b9d7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..6b68d36a0e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..0f74d52b58 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..4f0d8343cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..16ea89097e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs new file mode 100644 index 0000000000..0a53bb41b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBathroomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBathroomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBathroomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBathroomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs new file mode 100644 index 0000000000..047a550dc9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBedroomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBedroomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBedroomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBedroomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs new file mode 100644 index 0000000000..229e7cab38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBuildingResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBuildingResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryBuildingResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs new file mode 100644 index 0000000000..af051ea917 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryCyclePathResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryCyclePathResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryCyclePathResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs new file mode 100644 index 0000000000..5dca10e598 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryDistrictResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryDistrictResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryDistrictResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryDistrictResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs new file mode 100644 index 0000000000..99e139e5d3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryFamilyHomeResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryFamilyHomeResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryFamilyHomeResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryFamilyHomeResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs new file mode 100644 index 0000000000..e99ce77690 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryKitchenResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryKitchenResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryKitchenResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryKitchenResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs new file mode 100644 index 0000000000..f125e86438 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryLivingRoomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryLivingRoomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryLivingRoomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryLivingRoomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs new file mode 100644 index 0000000000..e9a202c5f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryMansionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryMansionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryMansionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryMansionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs new file mode 100644 index 0000000000..0fb5f7ad71 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryResidenceResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryResidenceResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryResidenceResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs new file mode 100644 index 0000000000..b2bf2db1d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoadResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryRoadResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryRoadResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs new file mode 100644 index 0000000000..82def113ea --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryRoomResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryRoomResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryRoomResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs new file mode 100644 index 0000000000..f841d26997 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryStaffMemberResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryStaffMemberResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryStaffMemberResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs new file mode 100644 index 0000000000..c67dbdc7d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/PrimaryToiletResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryToiletResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryToiletResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..edb075fccd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..8352aee801 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..91574b4c30 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..cf37d2ec1b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs new file mode 100644 index 0000000000..737a5b70f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs new file mode 100644 index 0000000000..4419001c73 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..e79429baef --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs new file mode 100644 index 0000000000..5ac47d4ef0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs new file mode 100644 index 0000000000..f69df43062 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateDistrictRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..80e5e94f80 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs new file mode 100644 index 0000000000..184853c913 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..36c8ec0bf2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..8c59f6a798 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..a95af47983 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..c97a7af201 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs new file mode 100644 index 0000000000..e57864b7da --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoadRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs new file mode 100644 index 0000000000..cb5fba02f9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs new file mode 100644 index 0000000000..f0e53f3077 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs new file mode 100644 index 0000000000..09ab4df065 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs new file mode 100644 index 0000000000..dc60b22687 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInDistrictResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..a879fb7031 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..98398c4035 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..9655f86fb6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..fcd806b8d1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..cb46857698 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..94c2c64322 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs new file mode 100644 index 0000000000..67d482e841 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoadResponse.cs @@ -0,0 +1,55 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..9cde803fb7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..c4d5ceaa2f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs new file mode 100644 index 0000000000..aab9b0b08c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs new file mode 100644 index 0000000000..1e6b84cb27 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..e88c23c337 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs new file mode 100644 index 0000000000..259d5aacfc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateCyclePathRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateCyclePathRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs new file mode 100644 index 0000000000..1eed06645d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateDistrictRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateDistrictRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..f480dcbdbd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs new file mode 100644 index 0000000000..d48b9e70ea --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs new file mode 100644 index 0000000000..f63f0c619f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..7e8a5f52ee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..1f9bdce3dc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..e9b4cc7a4d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs new file mode 100644 index 0000000000..143c62ec6f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoadRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRoadRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoadRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs new file mode 100644 index 0000000000..2e3173d1fe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs new file mode 100644 index 0000000000..80c56ae480 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RelationshipsInUpdateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipsInUpdateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs new file mode 100644 index 0000000000..8cb16dfb26 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..b0bdf82a9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..2d7d1bac29 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs new file mode 100644 index 0000000000..5e85183b85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..1f06ec35c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..170ee686d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..2e16fdce5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..34d11a9811 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..89478f5840 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..05536ed7be --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..d0c613c121 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..c0cd803664 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..069b5a875b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs new file mode 100644 index 0000000000..bd41c2a83f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoadResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..13c9b3b1b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs new file mode 100644 index 0000000000..221e23a4fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..439d90b774 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..7ff194472c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs new file mode 100644 index 0000000000..aab3e24817 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInRoomResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..8db59f0d81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..35d91313ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..bd2edf44f5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..3b43c0ea15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs new file mode 100644 index 0000000000..f2e4343706 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/SecondaryResidenceResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryResidenceResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryResidenceResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInResidenceResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs new file mode 100644 index 0000000000..9c3ea492ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInStaffMemberResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..f8a7cfbd82 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..1b4a907768 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..62883644c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..80be2f02de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs new file mode 100644 index 0000000000..036073ef95 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs new file mode 100644 index 0000000000..13c72202ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyBuildingInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyBuildingInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs new file mode 100644 index 0000000000..7069db6687 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs new file mode 100644 index 0000000000..165e536a50 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoadInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoadInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..c2dea650f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..10acdbcdb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..ff897a120b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..c331bec45f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..3b3ccf027a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..1cca5438d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs new file mode 100644 index 0000000000..b731297e9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToiletCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInToiletResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..08c1fe8100 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..a35a5c20cd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs new file mode 100644 index 0000000000..726afad270 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBathroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBathroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBathroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBathroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs new file mode 100644 index 0000000000..c78736d1c4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBedroomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBedroomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBedroomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBedroomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs new file mode 100644 index 0000000000..ffe2b9ed67 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs new file mode 100644 index 0000000000..a217f3c240 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateCyclePathRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateCyclePathRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateCyclePathRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateCyclePathRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateCyclePathRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs new file mode 100644 index 0000000000..ed0e71615f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateDistrictRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateDistrictRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateDistrictRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateDistrictRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs new file mode 100644 index 0000000000..c4a9b7c3f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateFamilyHomeRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateFamilyHomeRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateFamilyHomeRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs new file mode 100644 index 0000000000..0959023ce2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateKitchenRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateKitchenRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateKitchenRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateKitchenRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs new file mode 100644 index 0000000000..16ff2af485 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateLivingRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateLivingRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateLivingRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateLivingRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs new file mode 100644 index 0000000000..6202763be1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateMansionRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateMansionRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateMansionRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateMansionRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs new file mode 100644 index 0000000000..2886cdaade --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateResidenceRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateResidenceRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs new file mode 100644 index 0000000000..98949c3fdc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoadRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoadRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateRoadRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoadRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs new file mode 100644 index 0000000000..986853bf88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateRoomRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateRoomRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateRoomRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs new file mode 100644 index 0000000000..92032d0115 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateStaffMemberRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateStaffMemberRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateStaffMemberRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateStaffMemberRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs new file mode 100644 index 0000000000..6ff7e5eb43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Models/UpdateToiletRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateToiletRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.DataInUpdateToiletRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs new file mode 100644 index 0000000000..671f89ce4b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/NoOperationsInheritanceClient.cs @@ -0,0 +1,152 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class NoOperationsInheritanceClient : BaseRequestBuilder + { + /// The bathrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder Bathrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bathrooms.BathroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The bedrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder Bedrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Bedrooms.BedroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The cyclePaths property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder CyclePaths + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The kitchens property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder Kitchens + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Kitchens.KitchensRequestBuilder(PathParameters, RequestAdapter); + } + + /// The livingRooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder LivingRooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The mansions property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder Mansions + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Mansions.MansionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residences property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder Residences + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staffMembers property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder StaffMembers + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder(PathParameters, RequestAdapter); + } + + /// The toilets property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder Toilets + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public NoOperationsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..dd67d2c937 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3af9fe3880 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..c7d5273362 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs new file mode 100644 index 0000000000..cca0332c9e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item +{ + /// + /// Builds and executes requests for operations under \residences\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing residence by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual residence by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing residence. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing residence by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual residence by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateResidenceRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual residence by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing residence. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..855e716c4e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/Item/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related rooms of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs new file mode 100644 index 0000000000..c3d052fc9c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Residences/ResidencesRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences +{ + /// + /// Builds and executes requests for operations under \residences + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.residences.item collection + /// The identifier of the residence to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of residences. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new residence. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of residences. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateResidenceRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Residences.ResidencesRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of residences. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new residence. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs new file mode 100644 index 0000000000..a7f4fb2f39 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/Item/RoadsItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item +{ + /// + /// Builds and executes requests for operations under \roads\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing road by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual road by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing road. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing road by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual road by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing road. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoadRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual road by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing road. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..183c993c2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads +{ + /// + /// Builds and executes requests for operations under \roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.roads.item collection + /// The identifier of the road to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.Item.RoadsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/roads{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of roads. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoadCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new road. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoadResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of roads. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new road. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoadRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of roads. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new road. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..eb1ede6779 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..709d7eed62 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..c204476e01 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..3d79d4361e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item +{ + /// + /// Builds and executes requests for operations under \rooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing room by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual room by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing room. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing room by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual room by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual room by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing room. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..d94b753ccb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms +{ + /// + /// Builds and executes requests for operations under \rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.rooms.item collection + /// The identifier of the room to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of rooms. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.RoomCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new room. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryRoomResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of rooms. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateRoomRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of rooms. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new room. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs new file mode 100644 index 0000000000..49a8467e6d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/Item/StaffMembersItemRequestBuilder.cs @@ -0,0 +1,209 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item +{ + /// + /// Builds and executes requests for operations under \staffMembers\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffMembersItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffMembersItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing staffMember by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing staffMember. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing staffMember by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing staffMember. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateStaffMemberRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual staffMember by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing staffMember. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs new file mode 100644 index 0000000000..0401dfc38d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/StaffMembers/StaffMembersRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers +{ + /// + /// Builds and executes requests for operations under \staffMembers + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.staffMembers.item collection + /// The identifier of the staffMember to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.Item.StaffMembersItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffMembersRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffMembersRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/staffMembers{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of staffMembers. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.StaffMemberCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new staffMember. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryStaffMemberResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of staffMembers. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new staffMember. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateStaffMemberRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.StaffMembers.StaffMembersRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of staffMembers. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new staffMember. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffMembersRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..a49d8d42db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..cfb0d5a17e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..10551d094c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.SecondaryResidenceResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs new file mode 100644 index 0000000000..e39bd675f1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs @@ -0,0 +1,223 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item +{ + /// + /// Builds and executes requests for operations under \toilets\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing toilet by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing toilet. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing toilet by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Updates an existing toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.UpdateToiletRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual toilet by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Updates an existing toilet. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs new file mode 100644 index 0000000000..714b2e4833 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/GeneratedCode/Toilets/ToiletsRequestBuilder.cs @@ -0,0 +1,194 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets +{ + /// + /// Builds and executes requests for operations under \toilets + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.toilets.item collection + /// The identifier of the toilet to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of toilets. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ToiletCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new toilet. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.PrimaryToiletResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of toilets. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Creates a new toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models.CreateToiletRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Toilets.ToiletsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of toilets. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Creates a new toilet. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..7c93ad95cb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs @@ -0,0 +1,961 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.NoOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.NoOperations; + +public sealed class ResourceInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public ResourceInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_abstract_endpoint() + { + // Arrange + Residence residence = _fakers.Residence.GenerateOne(); + Mansion mansion = _fakers.Mansion.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(residence, mansion, familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + BuildingCollectionResponseDocument? response = await apiClient.Buildings.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(3); + + response.Data.OfType().Should().ContainSingle(data => data.Id == residence.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == mansion.StringId).Subject.With(data => + { + AttributesInMansionResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == familyHome.StringId).Subject.With(data => + { + AttributesInFamilyHomeResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_base_endpoint() + { + // Arrange + Road road = _fakers.Road.GenerateOne(); + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Roads.AddRange(road, cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoadCollectionResponseDocument? response = await apiClient.Roads.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == road.StringId).Subject.With(data => + { + AttributesInRoadResponse? attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(road.LengthInMeters); + + data.Relationships.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == cyclePath.StringId).Subject.With(data => + { + AttributesInCyclePathResponse attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + + data.Relationships.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome1 = _fakers.FamilyHome.GenerateOne(); + FamilyHome familyHome2 = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(familyHome1, familyHome2); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + FamilyHomeCollectionResponseDocument? response = await apiClient.FamilyHomes.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == familyHome1.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome1.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome1.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.Should().ContainSingle(data => data.Id == familyHome2.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome2.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome2.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_abstract_endpoint() + { + // Arrange + Mansion mansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[mansion.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(mansion.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_base_endpoint() + { + // Arrange + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads[cyclePath.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(cyclePath.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + }); + + response.Data.Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + PrimaryFamilyHomeResponseDocument? response = await apiClient.FamilyHomes[familyHome.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(familyHome.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + SecondaryResidenceResponseDocument? response = await apiClient.Rooms[bedroom.StringId!].Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + SecondaryResidenceResponseDocument? response = await apiClient.Bedrooms[bedroom.StringId!].Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoomCollectionResponseDocument? response = await apiClient.Residences[familyHome.StringId!].Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId).Subject.With(data => + { + AttributesInKitchenResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(kitchen.SurfaceInSquareMeters); + attributes.HasPantry.Should().Be(kitchen.HasPantry); + + RelationshipsInKitchenResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId).Subject.With(data => + { + AttributesInBedroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bedroom.SurfaceInSquareMeters); + attributes.BedCount.Should().Be(bedroom.BedCount); + + RelationshipsInBedroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + RoomCollectionResponseDocument? response = await apiClient.Mansions[mansion.StringId!].Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId).Subject.With(data => + { + AttributesInBathroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bathroom.SurfaceInSquareMeters); + attributes.HasBath.Should().Be(bathroom.HasBath); + + RelationshipsInBathroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId).Subject.With(data => + { + AttributesInToiletResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(toilet.SurfaceInSquareMeters); + attributes.HasSink.Should().Be(toilet.HasSink); + + RelationshipsInToiletResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_create_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateRoadRequestDocument requestBody = new() + { + Data = new DataInCreateRoadRequest + { + Type = ResourceType.Roads, + Attributes = new AttributesInCreateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + long newRoadId = long.Parse(roadData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(newRoadId); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateBuildingRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInCreateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom1.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom2.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.LivingRooms, + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "rooms" + }); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + CreateResidenceRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryResidenceResponseDocument? response = await apiClient.Residences.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + Road existingRoad = _fakers.Road.GenerateOne(); + + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(existingRoad); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateRoadRequestDocument requestBody = new() + { + Data = new DataInUpdateRoadRequest + { + Type = ResourceType.Roads, + Id = existingRoad.StringId!, + Attributes = new AttributesInUpdateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await apiClient.Roads[existingRoad.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(existingRoad.Id); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInUpdateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom1.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom2.StringId! + }, + new RoomIdentifierInRequest + { + Type = ResourceType.LivingRooms, + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "rooms" + }); + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[existingFamilyHome.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryBuildingResponseDocument? response = await apiClient.Buildings[existingFamilyHome.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(1); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == existingFamilyHome.Rooms.ElementAt(0).Id); + }); + } + + [Fact] + public async Task Can_delete_concrete_derived_resource_at_abstract_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new NoOperationsInheritanceClient(requestAdapter); + + // Act + await apiClient.Buildings[existingMansion.StringId!].DeleteAsync(); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome? familyHomeInDatabase = await dbContext.FamilyHomes.FirstWithIdOrDefaultAsync(existingMansion.Id); + + familyHomeInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs new file mode 100644 index 0000000000..2faf4d95e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/BathroomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms +{ + /// + /// Builds and executes requests for operations under \bathrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.bathrooms.item collection + /// The identifier of the bathroom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.BathroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..28a422a10a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/BathroomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BathroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BathroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..3bc2420018 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..176f1eb2bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bathrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bathrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bathrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bathroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bathroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs new file mode 100644 index 0000000000..5e7e71c07b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/BedroomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms +{ + /// + /// Builds and executes requests for operations under \bedrooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.bedrooms.item collection + /// The identifier of the bedroom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.BedroomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs new file mode 100644 index 0000000000..46ba9a6b3b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/BedroomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BedroomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BedroomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..f90a7b878f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..f2e6fdc796 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Bedrooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \bedrooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/bedrooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual bedroom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual bedroom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..91cd94cb58 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.districts.item collection + /// The identifier of the district whose related building identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder this[Guid position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.DistrictsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs new file mode 100644 index 0000000000..a53f2f111f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/DistrictsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item +{ + /// + /// Builds and executes requests for operations under \districts\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..2c763350f3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/buildings{?query*}", rawUrl) + { + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing buildings from the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing buildings to the buildings relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related building identities of an individual district's buildings relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..8fd8f8bd25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder Roads + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs new file mode 100644 index 0000000000..327ff7860a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Districts/Item/Relationships/Roads/RoadsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads +{ + /// + /// Builds and executes requests for operations under \districts\{id}\relationships\roads + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoadsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts/{id}/relationships/roads{?query*}", rawUrl) + { + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing roads from the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing roads to the roads relationship of an individual district. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.Item.Relationships.Roads.RoadsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related road identities of an individual district's roads relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoadsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..e9c32fdaff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..ed3b04f708 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..b444317972 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..5db68f23c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual familyHome. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs new file mode 100644 index 0000000000..24db678ff1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/KitchensItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item +{ + /// + /// Builds and executes requests for operations under \kitchens\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..aad4c41847 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..64e2187053 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \kitchens\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual kitchen. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual kitchen's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs new file mode 100644 index 0000000000..e7bc03280b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Kitchens/KitchensRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens +{ + /// + /// Builds and executes requests for operations under \kitchens + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class KitchensRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.kitchens.item collection + /// The identifier of the kitchen whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.Item.KitchensItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public KitchensRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/kitchens", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..c2e63940f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/LivingRoomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..a5a20b15ce --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..b93d8e89f8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \livingRooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual livingRoom. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual livingRoom's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs new file mode 100644 index 0000000000..3df6c70421 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/LivingRooms/LivingRoomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms +{ + /// + /// Builds and executes requests for operations under \livingRooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class LivingRoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.livingRooms.item collection + /// The identifier of the livingRoom whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.Item.LivingRoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public LivingRoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/livingRooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs new file mode 100644 index 0000000000..e28ea4f657 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/MansionsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item +{ + /// + /// Builds and executes requests for operations under \mansions\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..d1ae8eb805 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder Staff + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..8559c1e418 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual mansion's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs new file mode 100644 index 0000000000..f311818aac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/Item/Relationships/Staff/StaffRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff +{ + /// + /// Builds and executes requests for operations under \mansions\{id}\relationships\staff + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public StaffRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions/{id}/relationships/staff{?query*}", rawUrl) + { + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing staffMembers from the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing staffMembers to the staff relationship of an individual mansion. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.Relationships.Staff.StaffRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related staffMember identities of an individual mansion's staff relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class StaffRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs new file mode 100644 index 0000000000..96bb107cec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Mansions/MansionsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions +{ + /// + /// Builds and executes requests for operations under \mansions + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class MansionsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.mansions.item collection + /// The identifier of the mansion whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.Item.MansionsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public MansionsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/mansions", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs new file mode 100644 index 0000000000..0e9bbb9331 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum AddOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "add")] + #pragma warning disable CS1591 + Add, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..4143782e3b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..491c7bb12c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..2bcd6624a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..799fc718e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..763e97fd5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..ca2267c9e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AddToResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..febb9386bc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,107 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addToDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictBuildingsRelationshipOperation(), + "addToDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToDistrictRoadsRelationshipOperation(), + "addToFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(), + "addToMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionRoomsRelationshipOperation(), + "addToMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToMansionStaffRelationshipOperation(), + "addToResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AddToResidenceRoomsRelationshipOperation(), + "removeFromDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation(), + "removeFromDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation(), + "removeFromFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation(), + "removeFromMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(), + "removeFromMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(), + "removeFromResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation(), + "updateBathroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(), + "updateBedroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(), + "updateDistrictBuildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation(), + "updateDistrictRoads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation(), + "updateFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation(), + "updateKitchenResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(), + "updateLivingRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(), + "updateMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation(), + "updateMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation(), + "updateResidenceRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation(), + "updateRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(), + "updateToiletResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..7300ca2577 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..c30522c543 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..9c60fb2434 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..bed3610a61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..fc32f3a944 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..aacdc4d995 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..406132dd44 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..e00c377eb1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..a90cdecac6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs new file mode 100644 index 0000000000..ebcb35eabe --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..4d1a6ba08c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs new file mode 100644 index 0000000000..477bc183b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictBuildingsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictBuildingsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs new file mode 100644 index 0000000000..40b7f00d41 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictBuildingsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DistrictBuildingsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs new file mode 100644 index 0000000000..15cf98cad9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DistrictResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs new file mode 100644 index 0000000000..bdc96f78bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictRoadsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictRoadsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetGuidValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteGuidValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs new file mode 100644 index 0000000000..f81f345607 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/DistrictRoadsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DistrictRoadsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..a992df3506 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..27e8c66e17 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..6d1af3228b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..c14aa4fb5f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..250b544f85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..26ec985023 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..829e6af19c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..154dcaf1b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,96 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..29aa2132d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..0898c1303c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..3441c0b18b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..85f205b62c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..4d98aeb73b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..fbd0850f8f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs new file mode 100644 index 0000000000..487c9d3324 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs new file mode 100644 index 0000000000..427641c710 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionStaffRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionStaffRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs new file mode 100644 index 0000000000..77cb0a08fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/MansionStaffRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionStaffRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "staff")] + #pragma warning disable CS1591 + Staff, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..6e0ac0995e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..a2dc93bcd8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..3b5d5fed63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..7550cf1801 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..0b8f61cd81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..6b48a1b594 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..325180cab0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..6a93441877 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..a095c7e1c6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveFromResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RemoveFromResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..fdce79bec1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..4c9355ec83 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..a35c6f3285 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs new file mode 100644 index 0000000000..adb0c6d282 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs new file mode 100644 index 0000000000..c22582634f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResidenceResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..8fdf5a9cc5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResidenceRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs new file mode 100644 index 0000000000..b3d503202b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResidenceRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResidenceRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..591118db9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..65fc63a1ec --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..90666b96d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..a9100614f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..d2a7100a24 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..c86d306da9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs new file mode 100644 index 0000000000..c9aba1bf9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..2ecbd9c590 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..29e51bb24a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..0269341a9f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..89e413363d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..a1dc140ad3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs new file mode 100644 index 0000000000..0de8196836 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomResidenceRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomResidenceRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs new file mode 100644 index 0000000000..81c5aee1d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResidenceRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResidenceRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "residence")] + #pragma warning disable CS1591 + Residence, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..673a7a2627 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..a4fa0cac51 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..bdb650701e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..3510ef6d72 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..0bab511da5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs new file mode 100644 index 0000000000..e92d08b38b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyBuildingInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyBuildingInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs new file mode 100644 index 0000000000..bc28c2046e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoadInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoadInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..6d86a46351 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..f3c2657bb4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..35ec5e1481 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..ef9987c75e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..b2b4b5e49e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..eba920be53 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..5a33375f85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs new file mode 100644 index 0000000000..fbffe5563f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictBuildingsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictBuildingsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictBuildingsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.BuildingIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictBuildingsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs new file mode 100644 index 0000000000..11ec569385 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateDistrictRoadsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateDistrictRoadsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateDistrictRoadsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoadIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.DistrictRoadsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..85d83cd7e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..4201ad673f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..88d038fea0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..3936393248 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionRoomsRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..b90a70b240 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..0145d31557 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..9e339cc0e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateResidenceRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateResidenceRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..c519144898 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomResidenceRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..9d9f1a527f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs new file mode 100644 index 0000000000..12057ec348 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/OnlyRelationshipsInheritanceClient.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OnlyRelationshipsInheritanceClient : BaseRequestBuilder + { + /// The bathrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.BathroomsRequestBuilder Bathrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bathrooms.BathroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The bedrooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.BedroomsRequestBuilder Bedrooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Bedrooms.BedroomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The kitchens property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.KitchensRequestBuilder Kitchens + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Kitchens.KitchensRequestBuilder(PathParameters, RequestAdapter); + } + + /// The livingRooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder LivingRooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.LivingRooms.LivingRoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The mansions property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.MansionsRequestBuilder Mansions + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Mansions.MansionsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The residences property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.ResidencesRequestBuilder Residences + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.ResidencesRequestBuilder(PathParameters, RequestAdapter); + } + + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The toilets property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.ToiletsRequestBuilder Toilets + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.ToiletsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public OnlyRelationshipsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..7bbb822cfc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..ca1fbcf640 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..4791a55075 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \residences\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing rooms from the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing rooms to the rooms relationship of an individual residence. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToManyRoomInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual residence's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs new file mode 100644 index 0000000000..0460573b86 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/Item/ResidencesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item +{ + /// + /// Builds and executes requests for operations under \residences\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs new file mode 100644 index 0000000000..5dd0f2107e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Residences/ResidencesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences +{ + /// + /// Builds and executes requests for operations under \residences + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidencesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.residences.item collection + /// The identifier of the residence whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Residences.Item.ResidencesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidencesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/residences", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c2bf625624 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..b6c5f16374 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \rooms\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual room. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual room's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs new file mode 100644 index 0000000000..3dd1f57547 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/Item/RoomsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item +{ + /// + /// Builds and executes requests for operations under \rooms\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..ff88914623 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms +{ + /// + /// Builds and executes requests for operations under \rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.rooms.item collection + /// The identifier of the room whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Rooms.Item.RoomsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/rooms", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..87db76543d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder Residence + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs new file mode 100644 index 0000000000..70ceef10dc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/Relationships/Residence/ResidenceRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence +{ + /// + /// Builds and executes requests for operations under \toilets\{id}\relationships\residence + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ResidenceRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}/relationships/residence{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ResidenceIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing residence to the residence relationship of an individual toilet. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models.ToOneResidenceInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.Residence.ResidenceRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related residence identity of an individual toilet's residence relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ResidenceRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs new file mode 100644 index 0000000000..9cb2ac94af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/Item/ToiletsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item +{ + /// + /// Builds and executes requests for operations under \toilets\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs new file mode 100644 index 0000000000..6e4af346e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/GeneratedCode/Toilets/ToiletsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets +{ + /// + /// Builds and executes requests for operations under \toilets + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ToiletsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.toilets.item collection + /// The identifier of the toilet whose related residence identity to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Toilets.Item.ToiletsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ToiletsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/toilets", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs new file mode 100644 index 0000000000..51ce915018 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs @@ -0,0 +1,913 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.OnlyRelationships; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.OnlyRelationships; + +public sealed class RelationshipInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public RelationshipInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + // GET /rooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + ResidenceIdentifierResponseDocument? response = await apiClient.Rooms[bedroom.StringId!].Relationships.Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /bedrooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + ResidenceIdentifierResponseDocument? response = await apiClient.Bedrooms[bedroom.StringId!].Relationships.Residence.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /residences/1/relationships/rooms => [kitchen, bedroom] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + RoomIdentifierCollectionResponseDocument? response = await apiClient.Residences[familyHome.StringId!].Relationships.Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId); + } + + // GET /mansions/1/relationships/rooms => [bathroom, toilet] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + // Act + RoomIdentifierCollectionResponseDocument? response = await apiClient.Mansions[mansion.StringId!].Relationships.Rooms.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId); + } + + // PATCH /rooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Rooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /rooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Rooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Bathrooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Id = existingMansion.StringId + } + }; + + // Act + await apiClient.Bathrooms[existingBathroom.StringId!].Relationships.Residence.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PatchAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingBedroom.StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.PostAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // DELETE /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Residences[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Type = ResourceType.Rooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new OnlyRelationshipsInheritanceClient(requestAdapter); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Type = ResourceType.Bedrooms, + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await apiClient.Mansions[existingMansion.StringId!].Relationships.Rooms.DeleteAsync(requestBody); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs new file mode 100644 index 0000000000..819a6719fa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum AddOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "add")] + #pragma warning disable CS1591 + Add, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..9122113872 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AddToFamilyHomeRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AddToFamilyHomeRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs new file mode 100644 index 0000000000..533529ecb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicOperation.cs @@ -0,0 +1,104 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicOperation : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The openapiDiscriminator property + public string? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicOperation() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "addBathroom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation(), + "addBedroom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation(), + "addFamilyHome" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation(), + "addKitchen" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation(), + "addLivingRoom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation(), + "addMansion" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation(), + "addResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation(), + "addRoom" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation(), + "addToFamilyHomeRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddToFamilyHomeRoomsRelationshipOperation(), + "addToilet" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation(), + "removeFromMansionRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(), + "removeFromMansionStaff" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(), + "updateBathroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(), + "updateBedroomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(), + "updateFamilyHome" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation(), + "updateKitchenResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(), + "updateLivingRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(), + "updateMansion" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation(), + "updateResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation(), + "updateRoomResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(), + "updateToiletResidence" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteStringValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs new file mode 100644 index 0000000000..189db8df34 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AtomicResult.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AtomicResult : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AtomicResult() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..98f9ccbb28 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..e5affa67a8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..b0b3b0e1e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs new file mode 100644 index 0000000000..a091d48395 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBathroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs new file mode 100644 index 0000000000..854cf0e850 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBedroomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..e8214666de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..fc292a733a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs new file mode 100644 index 0000000000..892c3668ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateKitchenRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..f53b83cdf3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateLivingRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..c1e61f73fc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..0ce7fd18a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..ff14472361 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs new file mode 100644 index 0000000000..1dbc602b9b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs new file mode 100644 index 0000000000..03ecd3ccd4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInCreateToiletRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..e91dda6c0f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..25243a6e64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..2f94318bc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..3035f0a06f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..7478c31f8d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..7947bafc0d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..1565e0301b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..3b313fe0d8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..71c24d37b1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..e40e228f61 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..64431ad387 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..9471064dd5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..439b6e3db1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..aa77201377 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..e3c01d0ca0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..3f5ea328d1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..192d06f0a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs new file mode 100644 index 0000000000..71fbaef20d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..43b3757972 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..1101a8853d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs new file mode 100644 index 0000000000..1dc8648c8d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBathroomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBathroomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBathroomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs new file mode 100644 index 0000000000..0bd80b987b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateBedroomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBedroomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateBedroomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs new file mode 100644 index 0000000000..4ac8dd7275 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateFamilyHomeOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateFamilyHomeOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateFamilyHomeOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs new file mode 100644 index 0000000000..5109ac68e6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateKitchenOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateKitchenOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateKitchenOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs new file mode 100644 index 0000000000..7dc4a8c470 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateLivingRoomOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateLivingRoomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateLivingRoomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs new file mode 100644 index 0000000000..62cbfe268b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateMansionOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateMansionOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateMansionOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs new file mode 100644 index 0000000000..45d0ca7632 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateResidenceOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateResidenceOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateResidenceOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs new file mode 100644 index 0000000000..5d4b82e81c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateRoomOperation.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateRoomOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AddOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs new file mode 100644 index 0000000000..e141dcf45c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/CreateToiletOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateToiletOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateRoomOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.CreateToiletOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..209e60e20c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..b9c0185eb1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..47dbd2fd41 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs new file mode 100644 index 0000000000..081b74e99c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs new file mode 100644 index 0000000000..537a8cca38 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..5f489f6974 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..96e4076338 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs new file mode 100644 index 0000000000..6c15e646ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..ae7e7358ba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..8c8be64e13 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..24059018f0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs new file mode 100644 index 0000000000..bb8415c42f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateRoomRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs new file mode 100644 index 0000000000..ebe9e9e410 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..87c8905d40 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..b8fb9a81b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..58e824d1a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..f66ac6f6cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..e6af095df7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..69349b71c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..e935922e06 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..ac5872448d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..c8a964a981 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..2298f480bd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..59e28a79c1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..63f0f363e0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..bc37ec172f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..6510f5a96b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..ec82e2fa2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..2cf0cf3b8b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs new file mode 100644 index 0000000000..d97a11846a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..8e2679ad47 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs new file mode 100644 index 0000000000..137d5442b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum FamilyHomeResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..39c141405a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public FamilyHomeRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs new file mode 100644 index 0000000000..7429d6b60c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/FamilyHomeRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum FamilyHomeRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..41f6b2aca0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..7da663f22c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..42521bcf2a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..831828e8ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..c4d0e79170 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs new file mode 100644 index 0000000000..bb3e3158a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..f2d27f433d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs new file mode 100644 index 0000000000..caf0b5404d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs new file mode 100644 index 0000000000..b48f1b49c2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionRoomsRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionRoomsRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs new file mode 100644 index 0000000000..1a8e469550 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionRoomsRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionRoomsRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs new file mode 100644 index 0000000000..4dfc858ac1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionStaffRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public MansionStaffRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs new file mode 100644 index 0000000000..ec44953c88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/MansionStaffRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum MansionStaffRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "staff")] + #pragma warning disable CS1591 + Staff, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..1ea6ae9e08 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs new file mode 100644 index 0000000000..7b082fd130 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicOperations property + public List? AtomicOperations + { + get { return BackingStore?.Get?>("atomic:operations"); } + set { BackingStore?.Set("atomic:operations", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:operations", n => { AtomicOperations = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:operations", AtomicOperations); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs new file mode 100644 index 0000000000..b0289c2a4d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/OperationsResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class OperationsResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The atomicResults property + public List? AtomicResults + { + get { return BackingStore?.Get?>("atomic:results"); } + set { BackingStore?.Set("atomic:results", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public OperationsResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "atomic:results", n => { AtomicResults = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicResult.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("atomic:results", AtomicResults); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..b46e93f5db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..7fee235be0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..ad3b9d40cc --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..086834d097 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs new file mode 100644 index 0000000000..75fc9b1208 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBathroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBathroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs new file mode 100644 index 0000000000..7cab1ca126 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBedroomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBedroomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..50a24dcd76 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..bd4c3254f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs new file mode 100644 index 0000000000..677c53110f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateKitchenRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateKitchenRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs new file mode 100644 index 0000000000..a9158cc843 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateLivingRoomRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateLivingRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..77308a0713 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..745beda79a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..b6eab58938 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs new file mode 100644 index 0000000000..3f2865ba35 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateRoomRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRoomRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs new file mode 100644 index 0000000000..606836ab3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInCreateToiletRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateToiletRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateRoomRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInCreateToiletRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..ad5618acc3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..58ef29ab15 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..0e1b08055a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..f34735a430 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..4f3e9acd8b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..071fede4a7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..16c3c2ea1f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..55e9808d2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..e085a94a4c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..ba2117d3ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..ec72193d54 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..f27b90a2cf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..0188f28d4a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs new file mode 100644 index 0000000000..8fa3b08883 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionRoomsRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionRoomsRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionRoomsRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionRoomsRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs new file mode 100644 index 0000000000..80ab4892b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveFromMansionStaffRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RemoveFromMansionStaffRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RemoveFromMansionStaffRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionStaffRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs new file mode 100644 index 0000000000..aba5993194 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RemoveOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RemoveOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "remove")] + #pragma warning disable CS1591 + Remove, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs new file mode 100644 index 0000000000..893c562a14 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..934cf9c434 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..7f596adfe4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBathroomRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBedroomRequest(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateKitchenRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateLivingRoomRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateResidenceRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateRoomRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInCreateToiletRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..9476d7c9a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInBuildingResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInResidenceResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..f9fc29941b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..ee38acc9b8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..fd38a0604f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..b5b42b8b81 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,58 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..021f76a3a6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..60a3ac6234 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs new file mode 100644 index 0000000000..73755a5e9e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipIdentifier.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomResidenceRelationshipIdentifier : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// The relationship property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipName? Relationship + { + get { return BackingStore?.Get("relationship"); } + set { BackingStore?.Set("relationship", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomResidenceRelationshipIdentifier() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + { "relationship", n => { Relationship = n.GetEnumValue(); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + writer.WriteEnumValue("relationship", Relationship); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs new file mode 100644 index 0000000000..b10e9bf6df --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResidenceRelationshipName.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResidenceRelationshipName + #pragma warning restore CS1591 + { + [EnumMember(Value = "residence")] + #pragma warning disable CS1591 + Residence, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..b9aff9a41e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..25b9db0424 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The lid property + public string? Lid + { + get { return BackingStore?.Get("lid"); } + set { BackingStore?.Set("lid", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + { "lid", n => { Lid = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + writer.WriteStringValue("lid", Lid); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..a6ef6ac879 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..7dbd4afb02 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..352d3e295b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..8800c48c80 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..94cc664f89 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..1e0521601c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs new file mode 100644 index 0000000000..132fca3262 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..258a4c16eb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..f02b763d60 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..7b02759616 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..37aeb3e0fd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBathroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBathroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBathroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..96fa8dc04e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateBedroomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBedroomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateBedroomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs new file mode 100644 index 0000000000..23ce1283ae --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateFamilyHomeOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateFamilyHomeOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateFamilyHomeOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..0feb395978 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateKitchenResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateKitchenResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateKitchenResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..eb085bde37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateLivingRoomResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateLivingRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateLivingRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs new file mode 100644 index 0000000000..0e9c20fc91 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateMansionOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateMansionOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateMansionOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs new file mode 100644 index 0000000000..44e69148e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateOperationCode.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum UpdateOperationCode + #pragma warning restore CS1591 + { + [EnumMember(Value = "update")] + #pragma warning disable CS1591 + Update, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs new file mode 100644 index 0000000000..b14a3e002b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateResidenceOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateResidenceOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateResidenceOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.DataInUpdateResidenceRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..5e9d650f72 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateRoomResidenceRelationshipOperation.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateRoomResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.AtomicOperation, IParsable + #pragma warning restore CS1591 + { + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The op property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateOperationCode? Op + { + get { return BackingStore?.Get("op"); } + set { BackingStore?.Set("op", value); } + } + + /// The ref property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier? Ref + { + get { return BackingStore?.Get("ref"); } + set { BackingStore?.Set("ref", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ResidenceIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "op", n => { Op = n.GetEnumValue(); } }, + { "ref", n => { Ref = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.RoomResidenceRelationshipIdentifier.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("data", Data); + writer.WriteEnumValue("op", Op); + writer.WriteObjectValue("ref", Ref); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs new file mode 100644 index 0000000000..18fc32b6d4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Models/UpdateToiletResidenceRelationshipOperation.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateToiletResidenceRelationshipOperation : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateRoomResidenceRelationshipOperation, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.UpdateToiletResidenceRelationshipOperation(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs new file mode 100644 index 0000000000..32b762f738 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/Operations/OperationsRequestBuilder.cs @@ -0,0 +1,94 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations +{ + /// + /// Builds and executes requests for operations under \operations + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class OperationsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public OperationsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/operations", rawUrl) + { + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs multiple mutations in a linear and atomic manner. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models.OperationsRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=atomic;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=atomic;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs new file mode 100644 index 0000000000..f5764b4205 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/GeneratedCode/SubsetOfOperationsInheritanceClient.cs @@ -0,0 +1,54 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SubsetOfOperationsInheritanceClient : BaseRequestBuilder + { + /// The operations property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder Operations + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Operations.OperationsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public SubsetOfOperationsInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs new file mode 100644 index 0000000000..3acddac8f6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs @@ -0,0 +1,352 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfOperations; + +public sealed class OperationsInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public OperationsInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_use_inheritance_at_operations_endpoint() + { + // Arrange + StaffMember existingStaffMember = _fakers.StaffMember.GenerateOne(); + + Mansion newMansion = _fakers.Mansion.GenerateOne(); + Kitchen newKitchen = _fakers.Kitchen.GenerateOne(); + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + Bedroom newBedroom = _fakers.Bedroom.GenerateOne(); + int? newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.StaffMembers.Add(existingStaffMember); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfOperationsInheritanceClient(requestAdapter); + + const string mansionLid = "mansion-lid"; + const string kitchenLid = "kitchen-lid"; + const string familyHomeLid = "family-home-lid"; + const string bedroomLid = "bedroom-lid"; + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + // NOTE: CreateBuildingOperation is not generated, because it is turned off. + new CreateResidenceOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateMansionRequest + { + Type = ResourceType.Mansions, + Lid = mansionLid, + Attributes = new AttributesInCreateMansionRequest + { + SurfaceInSquareMeters = newMansion.SurfaceInSquareMeters!.Value, + NumberOfResidents = newMansion.NumberOfResidents!.Value, + OwnerName = newMansion.OwnerName + }, + Relationships = new RelationshipsInCreateMansionRequest + { + Staff = new ToManyStaffMemberInRequest + { + Data = + [ + new StaffMemberIdentifierInRequest + { + Type = ResourceType.StaffMembers, + Id = existingStaffMember.StringId + } + ] + } + } + } + }, + // NOTE: It is possible to create an operation for abstract type. + new CreateRoomOperation + { + Op = AddOperationCode.Add, + // NOTE: DataInCreateRoomRequest is generated, but as abstract type. + Data = new DataInCreateKitchenRequest + { + Type = ResourceType.Kitchens, + Lid = kitchenLid, + Attributes = new AttributesInCreateKitchenRequest + { + SurfaceInSquareMeters = newKitchen.SurfaceInSquareMeters!.Value, + HasPantry = newKitchen.HasPantry!.Value + }, + Relationships = new RelationshipsInCreateKitchenRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Type = ResourceType.Mansions, + Lid = mansionLid + } + } + } + } + }, + new CreateFamilyHomeOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }, + new CreateBedroomOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateBedroomRequest + { + Type = ResourceType.Bedrooms, + Lid = bedroomLid, + Attributes = new AttributesInCreateBedroomRequest + { + SurfaceInSquareMeters = newBedroom.SurfaceInSquareMeters!.Value, + BedCount = newBedroom.BedCount!.Value + }, + Relationships = new RelationshipsInCreateBedroomRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new FamilyHomeIdentifierInRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid + } + } + } + } + }, + new AddToFamilyHomeRoomsRelationshipOperation + { + Op = AddOperationCode.Add, + Ref = new FamilyHomeRoomsRelationshipIdentifier + { + Type = FamilyHomeResourceType.FamilyHomes, + Relationship = FamilyHomeRoomsRelationshipName.Rooms, + Lid = familyHomeLid + }, + Data = + [ + new KitchenIdentifierInRequest + { + Type = ResourceType.Kitchens, + Lid = kitchenLid + } + ] + }, + new UpdateResidenceOperation + { + Op = UpdateOperationCode.Update, + // NOTE: Can use Ref to base type, while Data is derived. + Ref = new ResidenceIdentifierInRequest + { + Type = ResourceType.Residences, + Lid = familyHomeLid + }, + Data = new DataInUpdateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Lid = familyHomeLid, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + }, + new RemoveFromMansionStaffRelationshipOperation + { + Op = RemoveOperationCode.Remove, + Ref = new MansionStaffRelationshipIdentifier + { + Type = MansionResourceType.Mansions, + Relationship = MansionStaffRelationshipName.Staff, + Lid = mansionLid + }, + Data = [] + } + ] + }; + + // Act + OperationsResponseDocument? response = await apiClient.Operations.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.AtomicResults.Should().HaveCount(7); + + DataInMansionResponse mansionData = response.AtomicResults.ElementAt(0).Data.Should().BeOfType().Subject; + AttributesInMansionResponse mansionAttributes = mansionData.Attributes.Should().BeOfType().Subject; + mansionAttributes.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionAttributes.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionAttributes.OwnerName.Should().Be(newMansion.OwnerName); + mansionData.Relationships.Should().BeNull(); + + DataInKitchenResponse kitchenData = response.AtomicResults.ElementAt(1).Data.Should().BeOfType().Subject; + AttributesInKitchenResponse kitchenAttributes = kitchenData.Attributes.Should().BeOfType().Subject; + kitchenAttributes.SurfaceInSquareMeters.Should().Be(newKitchen.SurfaceInSquareMeters); + kitchenAttributes.HasPantry.Should().Be(newKitchen.HasPantry); + kitchenData.Relationships.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData2 = response.AtomicResults.ElementAt(2).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes2 = familyHomeData2.Attributes.Should().BeOfType().Subject; + familyHomeAttributes2.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes2.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes2.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData2.Relationships.Should().BeNull(); + + DataInBedroomResponse bedroomData = response.AtomicResults.ElementAt(3).Data.Should().BeOfType().Subject; + AttributesInBedroomResponse bedroomAttributes = bedroomData.Attributes.Should().BeOfType().Subject; + bedroomAttributes.SurfaceInSquareMeters.Should().Be(newBedroom.SurfaceInSquareMeters); + bedroomAttributes.BedCount.Should().Be(newBedroom.BedCount); + bedroomData.Relationships.Should().BeNull(); + + response.AtomicResults.ElementAt(4).Data.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData5 = response.AtomicResults.ElementAt(5).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes5 = familyHomeData5.Attributes.Should().BeOfType().Subject; + familyHomeAttributes5.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeAttributes5.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes5.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData5.Relationships.Should().BeNull(); + + response.AtomicResults.ElementAt(6).Data.Should().BeNull(); + + long newMansionId = long.Parse(mansionData.Id.Should().NotBeNull().And.Subject); + long newKitchenId = long.Parse(kitchenData.Id.Should().NotBeNull().And.Subject); + long newFamilyHomeId = long.Parse(familyHomeData2.Id.Should().NotBeNull().And.Subject); + long newBedroomId = long.Parse(bedroomData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Mansion mansionInDatabase = + await dbContext.Mansions.Include(mansion => mansion.Rooms).Include(mansion => mansion.Staff).FirstWithIdAsync(newMansionId); + + mansionInDatabase.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionInDatabase.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionInDatabase.OwnerName.Should().Be(newMansion.OwnerName); + + mansionInDatabase.Rooms.Should().BeEmpty(); + mansionInDatabase.Staff.Should().HaveCount(1); + mansionInDatabase.Staff.ElementAt(0).Id.Should().Be(existingStaffMember.Id); + + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(2); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == newKitchenId); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == newBedroomId); + }); + } + + [Fact] + public async Task Cannot_use_base_attributes_type_in_derived_data() + { + // Arrange + int newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters!.Value; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfOperationsInheritanceClient(requestAdapter); + + OperationsRequestDocument requestBody = new() + { + AtomicOperations = + [ + new CreateResidenceOperation + { + Op = AddOperationCode.Add, + Data = new DataInCreateFamilyHomeRequest + { + Type = ResourceType.FamilyHomes, + Attributes = new AttributesInCreateResidenceRequest + { + OpenapiDiscriminator = ResourceType.Residences, + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + } + ] + }; + + // Act + Func action = async () => await apiClient.Operations.PostAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Incompatible resource type found."); + error.Detail.Should().Be("Expected openapi:discriminator with value 'familyHomes' instead of 'residences'."); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/openapi:discriminator"); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs new file mode 100644 index 0000000000..07391862b9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/BuildingsRequestBuilder.cs @@ -0,0 +1,119 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings +{ + /// + /// Builds and executes requests for operations under \buildings + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.buildings.item collection + /// The identifier of the building to update. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings{?query*}", rawUrl) + { + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs new file mode 100644 index 0000000000..246d250d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Buildings/Item/BuildingsItemRequestBuilder.cs @@ -0,0 +1,103 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item +{ + /// + /// Builds and executes requests for operations under \buildings\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public BuildingsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/buildings/{id}{?query*}", rawUrl) + { + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing building. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.Item.BuildingsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Updates an existing building. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class BuildingsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs new file mode 100644 index 0000000000..669dfa603d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/CyclePathsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths +{ + /// + /// Builds and executes requests for operations under \cyclePaths + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.cyclePaths.item collection + /// The identifier of the cyclePath to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs new file mode 100644 index 0000000000..c66722264f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/CyclePaths/Item/CyclePathsItemRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item +{ + /// + /// Builds and executes requests for operations under \cyclePaths\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public CyclePathsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/cyclePaths/{id}{?query*}", rawUrl) + { + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.Item.CyclePathsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual cyclePath by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class CyclePathsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs new file mode 100644 index 0000000000..02116844d5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Districts/DistrictsRequestBuilder.cs @@ -0,0 +1,126 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts +{ + /// + /// Builds and executes requests for operations under \districts + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DistrictsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/districts{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of districts. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of districts. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DistrictsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs new file mode 100644 index 0000000000..162c733ba3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/FamilyHomesRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes +{ + /// + /// Builds and executes requests for operations under \familyHomes + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.familyHomes.item collection + /// The identifier of the familyHome whose related room identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.FamilyHomesItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs new file mode 100644 index 0000000000..d49a39c758 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/FamilyHomesItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class FamilyHomesItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public FamilyHomesItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..e8ffc0c1f4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder Rooms + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs new file mode 100644 index 0000000000..0d45a32849 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/FamilyHomes/Item/Relationships/Rooms/RoomsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms +{ + /// + /// Builds and executes requests for operations under \familyHomes\{id}\relationships\rooms + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RoomsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/familyHomes/{id}/relationships/rooms{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.Item.Relationships.Rooms.RoomsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related room identities of an individual familyHome's rooms relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RoomsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs new file mode 100644 index 0000000000..f51562d350 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBathroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasBath property + public bool? HasBath + { + get { return BackingStore?.Get("hasBath"); } + set { BackingStore?.Set("hasBath", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasBath", n => { HasBath = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasBath", HasBath); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs new file mode 100644 index 0000000000..6c44ab0a6a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBedroomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The bedCount property + public int? BedCount + { + get { return BackingStore?.Get("bedCount"); } + set { BackingStore?.Set("bedCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bedCount", n => { BedCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("bedCount", BedCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs new file mode 100644 index 0000000000..66b88075f7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInBuildingResponse.cs @@ -0,0 +1,66 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs new file mode 100644 index 0000000000..f4ff046637 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..59f327fe48 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs new file mode 100644 index 0000000000..df3c20bcb9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..9d7f3b41b8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs new file mode 100644 index 0000000000..e2a33c7932 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs new file mode 100644 index 0000000000..4a42106037 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInCyclePathResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasLaneForPedestrians property + public bool? HasLaneForPedestrians + { + get { return BackingStore?.Get("hasLaneForPedestrians"); } + set { BackingStore?.Set("hasLaneForPedestrians", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasLaneForPedestrians", n => { HasLaneForPedestrians = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasLaneForPedestrians", HasLaneForPedestrians); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs new file mode 100644 index 0000000000..38e8c822d7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInDistrictResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs new file mode 100644 index 0000000000..71753666e9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInFamilyHomeResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs new file mode 100644 index 0000000000..9cf8215f88 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInKitchenResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasPantry property + public bool? HasPantry + { + get { return BackingStore?.Get("hasPantry"); } + set { BackingStore?.Set("hasPantry", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasPantry", n => { HasPantry = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasPantry", HasPantry); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs new file mode 100644 index 0000000000..a98472a4e1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInLivingRoomResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasDiningTable property + public bool? HasDiningTable + { + get { return BackingStore?.Get("hasDiningTable"); } + set { BackingStore?.Set("hasDiningTable", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasDiningTable", n => { HasDiningTable = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasDiningTable", HasDiningTable); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs new file mode 100644 index 0000000000..6a6480ecc6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs new file mode 100644 index 0000000000..2f44b26537 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..f3c19d45ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs new file mode 100644 index 0000000000..5076e5f002 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoadResponse.cs @@ -0,0 +1,64 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The lengthInMeters property + public double? LengthInMeters + { + get { return BackingStore?.Get("lengthInMeters"); } + set { BackingStore?.Set("lengthInMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "lengthInMeters", n => { LengthInMeters = n.GetDoubleValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteDoubleValue("lengthInMeters", LengthInMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs new file mode 100644 index 0000000000..618fec1da5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs new file mode 100644 index 0000000000..4105e56251 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInStaffMemberResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs new file mode 100644 index 0000000000..2a4ac1e55e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInToiletResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// The hasSink property + public bool? HasSink + { + get { return BackingStore?.Get("hasSink"); } + set { BackingStore?.Set("hasSink", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "hasSink", n => { HasSink = n.GetBoolValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("hasSink", HasSink); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..36a77baa7e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateBuildingRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The surfaceInSquareMeters property + public int? SurfaceInSquareMeters + { + get { return BackingStore?.Get("surfaceInSquareMeters"); } + set { BackingStore?.Set("surfaceInSquareMeters", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "surfaceInSquareMeters", n => { SurfaceInSquareMeters = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("surfaceInSquareMeters", SurfaceInSquareMeters); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..14d8a06e14 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateFamilyHomeRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The floorCount property + public int? FloorCount + { + get { return BackingStore?.Get("floorCount"); } + set { BackingStore?.Set("floorCount", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "floorCount", n => { FloorCount = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("floorCount", FloorCount); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs new file mode 100644 index 0000000000..d7da56cfb5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The ownerName property + public string? OwnerName + { + get { return BackingStore?.Get("ownerName"); } + set { BackingStore?.Set("ownerName", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "ownerName", n => { OwnerName = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("ownerName", OwnerName); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..9136076afd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..7196132595 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/AttributesInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The numberOfResidents property + public int? NumberOfResidents + { + get { return BackingStore?.Get("numberOfResidents"); } + set { BackingStore?.Set("numberOfResidents", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "numberOfResidents", n => { NumberOfResidents = n.GetIntValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteIntValue("numberOfResidents", NumberOfResidents); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs new file mode 100644 index 0000000000..c8667f2d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs new file mode 100644 index 0000000000..91265e0f2e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BathroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BathroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs new file mode 100644 index 0000000000..15ecf781e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs new file mode 100644 index 0000000000..35b78a160d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BedroomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BedroomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs new file mode 100644 index 0000000000..2f8239c39d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingIdentifierInResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class BuildingIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public BuildingIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs new file mode 100644 index 0000000000..2222502413 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/BuildingResourceType.cs @@ -0,0 +1,26 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum BuildingResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs new file mode 100644 index 0000000000..873b8e6ca2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CreateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CreateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs new file mode 100644 index 0000000000..07cfbbc48e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/CyclePathIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CyclePathIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs new file mode 100644 index 0000000000..0899b315b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs new file mode 100644 index 0000000000..62b79767e7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs new file mode 100644 index 0000000000..d14abd360a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInBuildingResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs new file mode 100644 index 0000000000..30450c2557 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateBuildingRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..41e0cc12dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs new file mode 100644 index 0000000000..2b17ea5c87 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs new file mode 100644 index 0000000000..736bbef4db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCreateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs new file mode 100644 index 0000000000..55c88a9abb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs new file mode 100644 index 0000000000..dd086726b5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInDistrictResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public Guid? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInDistrictResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetGuidValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteGuidValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs new file mode 100644 index 0000000000..07aeee39b0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs new file mode 100644 index 0000000000..9f8c881ce1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs new file mode 100644 index 0000000000..74738018a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs new file mode 100644 index 0000000000..5943bcefeb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInMansionResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs new file mode 100644 index 0000000000..09ecacb0a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInResidenceResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs new file mode 100644 index 0000000000..75a85a06c4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoadResponse.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoadResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs new file mode 100644 index 0000000000..f9bba2e9af --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInRoomResponse.cs @@ -0,0 +1,95 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInRoomResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs new file mode 100644 index 0000000000..68850b163c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInStaffMemberResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInStaffMemberResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInStaffMemberResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs new file mode 100644 index 0000000000..ac2e5be1b3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..4ca06b894b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateBuildingRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.AttributesInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..5d84c23f2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs new file mode 100644 index 0000000000..66dcfd88ff --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateMansionRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..4137f1e4b2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DataInUpdateResidenceRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs new file mode 100644 index 0000000000..d97ffc5736 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/DistrictCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DistrictCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DistrictCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DistrictCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..673ff6cc69 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..9303d07110 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..4376a86884 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..23f6c86d5a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..d3e59f8189 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs new file mode 100644 index 0000000000..351eb51dd1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/FamilyHomeIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class FamilyHomeIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..1d781d6591 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,90 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInRequest(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInRequest(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs new file mode 100644 index 0000000000..2deed42b37 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs new file mode 100644 index 0000000000..2b4bdcf012 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/KitchenIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class KitchenIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs new file mode 100644 index 0000000000..b49157ed7f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs new file mode 100644 index 0000000000..eed8947a34 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/LivingRoomIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class LivingRoomIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs new file mode 100644 index 0000000000..83f7656f32 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/MansionIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class MansionIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..89d5f431a0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs new file mode 100644 index 0000000000..38250f348d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryBuildingResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryBuildingResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryBuildingResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryBuildingResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs new file mode 100644 index 0000000000..b206ebc91c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/PrimaryCyclePathResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryCyclePathResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryCyclePathResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.PrimaryCyclePathResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..41478b1ec3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs new file mode 100644 index 0000000000..fa353a6c65 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBathroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBathroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs new file mode 100644 index 0000000000..77d81a7b64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBedroomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBedroomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs new file mode 100644 index 0000000000..c18d2bce59 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInBuildingResponse.cs @@ -0,0 +1,57 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInBuildingResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs new file mode 100644 index 0000000000..62c52b5ec4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs new file mode 100644 index 0000000000..25fcd4de43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs new file mode 100644 index 0000000000..5d7bfd7a9a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..419975712e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs new file mode 100644 index 0000000000..bbb02cba5e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCreateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCreateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs new file mode 100644 index 0000000000..bd4d9ef5de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInCyclePathResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCyclePathResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs new file mode 100644 index 0000000000..80c9044b3d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInDistrictResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInDistrictResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse? Buildings + { + get { return BackingStore?.Get("buildings"); } + set { BackingStore?.Set("buildings", value); } + } + + /// The roads property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse? Roads + { + get { return BackingStore?.Get("roads"); } + set { BackingStore?.Set("roads", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "buildings", n => { Buildings = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse.CreateFromDiscriminatorValue); } }, + { "roads", n => { Roads = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("buildings", Buildings); + writer.WriteObjectValue("roads", Roads); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs new file mode 100644 index 0000000000..dac880d49a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInFamilyHomeResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInFamilyHomeResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs new file mode 100644 index 0000000000..8e90ff1076 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInKitchenResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInKitchenResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs new file mode 100644 index 0000000000..e32e7c4626 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInLivingRoomResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInLivingRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs new file mode 100644 index 0000000000..f79ff1330e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInMansionResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInMansionResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs new file mode 100644 index 0000000000..27fb9db71b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResidenceResponse.cs @@ -0,0 +1,65 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResidenceResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..0be66e31ad --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs new file mode 100644 index 0000000000..af23055a11 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoadResponse.cs @@ -0,0 +1,55 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoadResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInCyclePathResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoadResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs new file mode 100644 index 0000000000..6a5d51c9c0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInRoomResponse.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInRoomResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The residence property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse? Residence + { + get { return BackingStore?.Get("residence"); } + set { BackingStore?.Set("residence", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInBedroomResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInLivingRoomResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "residence", n => { Residence = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("residence", Residence); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs new file mode 100644 index 0000000000..b8b225006c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInToiletResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInToiletResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInRoomResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInToiletResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs new file mode 100644 index 0000000000..655169e932 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateBuildingRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateBuildingRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs new file mode 100644 index 0000000000..65e1aeb225 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateFamilyHomeRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateFamilyHomeRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs new file mode 100644 index 0000000000..70e3b955c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateMansionRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateMansionRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest, IParsable + #pragma warning restore CS1591 + { + /// The staff property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest? Staff + { + get { return BackingStore?.Get("staff"); } + set { BackingStore?.Set("staff", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "staff", n => { Staff = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("staff", Staff); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..5cd83e1238 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs new file mode 100644 index 0000000000..b45ac2e7c7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RelationshipsInUpdateResidenceRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateResidenceRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateBuildingRequest, IParsable + #pragma warning restore CS1591 + { + /// The rooms property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest? Rooms + { + get { return BackingStore?.Get("rooms"); } + set { BackingStore?.Set("rooms", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipsInUpdateResidenceRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "rooms", n => { Rooms = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("rooms", Rooms); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs new file mode 100644 index 0000000000..b7440b239b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResidenceIdentifierInResponse.cs @@ -0,0 +1,56 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResidenceIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.FamilyHomeIdentifierInResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.MansionIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..7dc32d06b6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..85b409632a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..2c679847d0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCreateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..7706ae85b7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBathroomResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBedroomResponse(), + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInBuildingResponse(), + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInCyclePathResponse(), + "districts" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInDistrictResponse(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInFamilyHomeResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInKitchenResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInLivingRoomResponse(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInMansionResponse(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInResidenceResponse(), + "roads" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoadResponse(), + "rooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInRoomResponse(), + "staffMembers" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInStaffMemberResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInToiletResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..6a079b9a5d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "buildings" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest(), + "familyHomes" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateFamilyHomeRequest(), + "mansions" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateMansionRequest(), + "residences" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateResidenceRequest(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..820dd6691d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..5619412cd0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..d5b1a5cc92 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "buildings")] + #pragma warning disable CS1591 + Buildings, + #pragma warning restore CS1591 + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "districts")] + #pragma warning disable CS1591 + Districts, + #pragma warning restore CS1591 + [EnumMember(Value = "familyHomes")] + #pragma warning disable CS1591 + FamilyHomes, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "mansions")] + #pragma warning disable CS1591 + Mansions, + #pragma warning restore CS1591 + [EnumMember(Value = "residences")] + #pragma warning disable CS1591 + Residences, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + [EnumMember(Value = "rooms")] + #pragma warning disable CS1591 + Rooms, + #pragma warning restore CS1591 + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs new file mode 100644 index 0000000000..2be26c8741 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadIdentifierInResponse.cs @@ -0,0 +1,93 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoadIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoadIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "cyclePaths" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.CyclePathIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs new file mode 100644 index 0000000000..1c560a02a4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoadResourceType.cs @@ -0,0 +1,22 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoadResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "cyclePaths")] + #pragma warning disable CS1591 + CyclePaths, + #pragma warning restore CS1591 + [EnumMember(Value = "roads")] + #pragma warning disable CS1591 + Roads, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..01a4ccf479 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs new file mode 100644 index 0000000000..aaddb4e5bb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs new file mode 100644 index 0000000000..193c047e5d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomIdentifierInResponse.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RoomIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RoomIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "bathrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BathroomIdentifierInResponse(), + "bedrooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BedroomIdentifierInResponse(), + "kitchens" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.KitchenIdentifierInResponse(), + "livingRooms" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.LivingRoomIdentifierInResponse(), + "toilets" => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse(), + _ => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs new file mode 100644 index 0000000000..f576271515 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/RoomResourceType.cs @@ -0,0 +1,34 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum RoomResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "bathrooms")] + #pragma warning disable CS1591 + Bathrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "bedrooms")] + #pragma warning disable CS1591 + Bedrooms, + #pragma warning restore CS1591 + [EnumMember(Value = "kitchens")] + #pragma warning disable CS1591 + Kitchens, + #pragma warning restore CS1591 + [EnumMember(Value = "livingRooms")] + #pragma warning disable CS1591 + LivingRooms, + #pragma warning restore CS1591 + [EnumMember(Value = "toilets")] + #pragma warning disable CS1591 + Toilets, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs new file mode 100644 index 0000000000..be1f9d92ca --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs new file mode 100644 index 0000000000..da77c1b8f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class StaffMemberIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public StaffMemberIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs new file mode 100644 index 0000000000..204f6b3966 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/StaffMemberResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum StaffMemberResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "staffMembers")] + #pragma warning disable CS1591 + StaffMembers, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs new file mode 100644 index 0000000000..0c8e337faa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyBuildingInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyBuildingInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyBuildingInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyBuildingInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.BuildingIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs new file mode 100644 index 0000000000..12eab9d58b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoadInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoadInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoadInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoadInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoadIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs new file mode 100644 index 0000000000..5775926ba8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs new file mode 100644 index 0000000000..0036f10528 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyRoomInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyRoomInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyRoomInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyRoomInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs new file mode 100644 index 0000000000..f931abee1e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs new file mode 100644 index 0000000000..86614046f1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToManyStaffMemberInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyStaffMemberInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyStaffMemberInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToManyStaffMemberInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.StaffMemberIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs new file mode 100644 index 0000000000..8a6886cbc2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToOneResidenceInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneResidenceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneResidenceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToOneResidenceInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ResidenceIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs new file mode 100644 index 0000000000..9571533797 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInRequest.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInRequest : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs new file mode 100644 index 0000000000..d2ce05f099 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/ToiletIdentifierInResponse.cs @@ -0,0 +1,50 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToiletIdentifierInResponse : global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.RoomIdentifierInResponse, IParsable + #pragma warning restore CS1591 + { + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.ToiletIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs new file mode 100644 index 0000000000..f22b72fce0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/Models/UpdateBuildingRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateBuildingRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateBuildingRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.UpdateBuildingRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.DataInUpdateBuildingRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs new file mode 100644 index 0000000000..d70ef584dd --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/GeneratedCode/SubsetOfVariousInheritanceClient.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class SubsetOfVariousInheritanceClient : BaseRequestBuilder + { + /// The buildings property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder Buildings + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Buildings.BuildingsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The cyclePaths property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.CyclePathsRequestBuilder CyclePaths + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.CyclePaths.CyclePathsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The districts property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder Districts + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Districts.DistrictsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The familyHomes property + public global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder FamilyHomes + { + get => new global::OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.FamilyHomes.FamilyHomesRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public SubsetOfVariousInheritanceClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs new file mode 100644 index 0000000000..7e40d74c18 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs @@ -0,0 +1,151 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode; +using OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfVarious; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.ResourceInheritance.SubsetOfVarious; + +public sealed class IncludeTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly ResourceInheritanceFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + District district = _fakers.District.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(_fakers.LivingRoom.GenerateOne()); + familyHome.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(familyHome); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(_fakers.Kitchen.GenerateOne()); + mansion.Rooms.Add(_fakers.Bathroom.GenerateOne()); + mansion.Rooms.Add(_fakers.Toilet.GenerateOne()); + district.Buildings.Add(mansion); + + Residence residence = _fakers.Residence.GenerateOne(); + residence.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(residence); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Districts.Add(district); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new SubsetOfVariousInheritanceClient(requestAdapter); + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "buildings.rooms" + }); + + // Act + DistrictCollectionResponseDocument? response = await apiClient.Districts.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(district.StringId); + + response.Included.Should().HaveCount(9); + + string familyHomeLivingRoomId = familyHome.Rooms.OfType().Single().StringId!; + string familyRoomBedroomId = familyHome.Rooms.OfType().Single().StringId!; + string mansionKitchenId = mansion.Rooms.OfType().Single().StringId!; + string mansionBathroomId = mansion.Rooms.OfType().Single().StringId!; + string mansionToiletId = mansion.Rooms.OfType().Single().StringId!; + string residenceBedroomId = residence.Rooms.OfType().Single().StringId!; + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHome.StringId).Subject.With(include => + { + AttributesInFamilyHomeResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(2); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyHomeLivingRoomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyRoomBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == mansion.StringId).Subject.With(include => + { + AttributesInMansionResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(3); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionKitchenId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionBathroomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionToiletId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == residence.StringId).Subject.With(include => + { + AttributesInResidenceResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(1); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == residenceBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHomeLivingRoomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == familyRoomBedroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionKitchenId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionBathroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionToiletId); + response.Included.OfType().Should().ContainSingle(include => include.Id == residenceBedroomId); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs new file mode 100644 index 0000000000..fca3f36228 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -0,0 +1,220 @@ +using System.Net; +using FluentAssertions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class CreateResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public CreateResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_create_resource_with_includes_and_fieldsets() + { + // Arrange + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + WriteOnlyChannel newChannel = _fakers.WriteOnlyChannel.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.DataStreams.AddRange(existingVideoStream, existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new CreateWriteOnlyChannelRequestDocument + { + Data = new DataInCreateWriteOnlyChannelRequest + { + Type = ResourceType.WriteOnlyChannels, + Attributes = new AttributesInCreateWriteOnlyChannelRequest + { + Name = newChannel.Name, + IsAdultOnly = newChannel.IsAdultOnly + }, + Relationships = new RelationshipsInCreateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingVideoStream.StringId! + } + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingAudioStream.StringId! + } + ] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "videoStream,audioStreams", + ["fields[writeOnlyChannels]"] = "name,isCommercial,videoStream,audioStreams", + ["fields[dataStreams]"] = "bytesTransmitted" + }); + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels.PostAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(newChannel.Name); + response.Data.Attributes.IsCommercial.Should().BeNull(); + response.Data.Attributes.IsAdultOnly.Should().BeNull(); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Id.Should().Be(existingVideoStream.StringId); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().HaveCount(1); + response.Data.Relationships.AudioStreams.Data.ElementAt(0).Id.Should().Be(existingAudioStream.StringId); + + response.Included.Should().HaveCount(2); + + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId).Subject.With( + include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == existingAudioStream.StringId).Subject.With( + include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + }); + + long newChannelId = long.Parse(response.Data.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(newChannelId); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(newChannel.Name); + channelInDatabase.IsCommercial.Should().BeNull(); + channelInDatabase.IsAdultOnly.Should().Be(newChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingVideoStream.Id); + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingAudioStream.Id); + }); + } + + [Fact] + public async Task Cannot_create_resource_for_missing_request_body() + { + // Arrange + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + CreateWriteOnlyChannelRequestDocument requestBody = null!; + + // Act + Func action = async () => _ = await apiClient.WriteOnlyChannels.PostAsync(requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_create_resource_with_unknown_relationship_ID() + { + // Arrange + WriteOnlyChannel newChannel = _fakers.WriteOnlyChannel.GenerateOne(); + + string unknownVideoStreamId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new CreateWriteOnlyChannelRequestDocument + { + Data = new DataInCreateWriteOnlyChannelRequest + { + Type = ResourceType.WriteOnlyChannels, + Attributes = new AttributesInCreateWriteOnlyChannelRequest + { + Name = newChannel.Name + }, + Relationships = new RelationshipsInCreateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = unknownVideoStreamId + } + } + } + } + }; + + // Act + Func action = async () => _ = await apiClient.WriteOnlyChannels.PostAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("A related resource does not exist."); + error.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownVideoStreamId}' in relationship 'videoStream' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/DeleteResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/DeleteResourceTests.cs new file mode 100644 index 0000000000..c19672be0b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/DeleteResourceTests.cs @@ -0,0 +1,85 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class DeleteResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public DeleteResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_delete_existing_resource() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].DeleteAsync(); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + WriteOnlyChannel? channelInDatabase = await dbContext.WriteOnlyChannels.FirstWithIdOrDefaultAsync(existingChannel.Id); + + channelInDatabase.Should().BeNull(); + }); + } + + [Fact] + public async Task Cannot_delete_unknown_resource() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + Func action = async () => await apiClient.WriteOnlyChannels[unknownChannelId].DeleteAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'writeOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs new file mode 100644 index 0000000000..9baa1d0f3e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs @@ -0,0 +1,158 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class FetchRelationshipTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public FetchRelationshipTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_get_ToOne_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + DataStreamIdentifierResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].Relationships.VideoStream.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.VideoStream.StringId); + } + + [Fact] + public async Task Can_get_empty_ToOne_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + NullableDataStreamIdentifierResponseDocument? response = + await apiClient.ReadOnlyChannels[channel.StringId!].Relationships.UltraHighDefinitionVideoStream.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_ToMany_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + channel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + DataStreamIdentifierCollectionResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].Relationships.AudioStreams.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + response.Data.Should().ContainSingle(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + response.Data.Should().ContainSingle(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + } + + [Fact] + public async Task Can_get_empty_ToMany_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + DataStreamIdentifierCollectionResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].Relationships.AudioStreams.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(0); + } + + [Fact] + public async Task Cannot_get_relationship_for_unknown_primary_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + Func action = async () => _ = await apiClient.ReadOnlyChannels[unknownChannelId].Relationships.VideoStream.GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs new file mode 100644 index 0000000000..05609f502e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/FetchResourceTests.cs @@ -0,0 +1,276 @@ +using System.Net; +using FluentAssertions; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class FetchResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public FetchResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_get_primary_resources() + { + // Arrange + List channels = _fakers.ReadOnlyChannel.GenerateList(2); + channels.ForEach(channel => channel.VideoStream = _fakers.DataStream.GenerateOne()); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.ReadOnlyChannels.AddRange(channels); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + ReadOnlyChannelCollectionResponseDocument? response = await apiClient.ReadOnlyChannels.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + DataInReadOnlyChannelResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); + channel1.Attributes.Should().NotBeNull(); + channel1.Attributes.Name.Should().Be(channels[0].Name); + channel1.Attributes.IsCommercial.Should().Be(channels[0].IsCommercial); + channel1.Attributes.IsAdultOnly.Should().Be(channels[0].IsAdultOnly); + channel1.Relationships.Should().NotBeNull(); + channel1.Relationships.VideoStream.Should().NotBeNull(); + channel1.Relationships.VideoStream.Data.Should().BeNull(); + channel1.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channel1.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + channel1.Relationships.AudioStreams.Should().NotBeNull(); + channel1.Relationships.AudioStreams.Data.Should().BeNull(); + + DataInReadOnlyChannelResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); + channel2.Attributes.Should().NotBeNull(); + channel2.Attributes.Name.Should().Be(channels[1].Name); + channel2.Attributes.IsCommercial.Should().Be(channels[1].IsCommercial); + channel2.Attributes.IsAdultOnly.Should().Be(channels[1].IsAdultOnly); + channel2.Relationships.Should().NotBeNull(); + channel2.Relationships.VideoStream.Should().NotBeNull(); + channel2.Relationships.VideoStream.Data.Should().BeNull(); + channel2.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channel2.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + channel2.Relationships.AudioStreams.Should().NotBeNull(); + channel2.Relationships.AudioStreams.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_by_ID() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + PrimaryReadOnlyChannelResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(channel.Name); + response.Data.Attributes.IsCommercial.Should().Be(channel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().Be(channel.IsAdultOnly); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().BeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeNull(); + } + + [Fact] + public async Task Cannot_get_primary_resource_for_unknown_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + Func action = async () => _ = await apiClient.ReadOnlyChannels[unknownChannelId].GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + [Fact] + public async Task Can_get_secondary_ToOne_resource() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + SecondaryDataStreamResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].VideoStream.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.VideoStream.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.BytesTransmitted.Should().Be((long?)channel.VideoStream.BytesTransmitted); + } + + [Fact] + public async Task Can_get_unknown_secondary_ToOne_resource() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + NullableSecondaryDataStreamResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].UltraHighDefinitionVideoStream.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_secondary_ToMany_resources() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + channel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + DataStreamCollectionResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].AudioStreams.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + DataInDataStreamResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + audioStream1.Attributes.Should().NotBeNull(); + audioStream1.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(0).BytesTransmitted); + + DataInDataStreamResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + audioStream2.Attributes.Should().NotBeNull(); + audioStream2.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(1).BytesTransmitted); + } + + [Fact] + public async Task Can_get_no_secondary_ToMany_resources() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + DataStreamCollectionResponseDocument? response = await apiClient.ReadOnlyChannels[channel.StringId!].AudioStreams.GetAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(0); + } + + [Fact] + public async Task Cannot_get_secondary_resource_for_unknown_primary_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + // Act + Func action = async () => _ = await apiClient.ReadOnlyChannels[unknownChannelId].VideoStream.GetAsync(); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs new file mode 100644 index 0000000000..ac1fb093a5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/DataStreamsRequestBuilder.cs @@ -0,0 +1,140 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams +{ + /// + /// Builds and executes requests for operations under \dataStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.dataStreams.item collection + /// The identifier of the dataStream to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item.DataStreamsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item.DataStreamsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DataStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/dataStreams{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DataStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/dataStreams{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of dataStreams. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of dataStreams. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.DataStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.DataStreamsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of dataStreams. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/Item/DataStreamsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/Item/DataStreamsItemRequestBuilder.cs new file mode 100644 index 0000000000..9dd3d5b5ba --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/DataStreams/Item/DataStreamsItemRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item +{ + /// + /// Builds and executes requests for operations under \dataStreams\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public DataStreamsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/dataStreams/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public DataStreamsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/dataStreams/{id}{?query*}", rawUrl) + { + } + + /// + /// Retrieves an individual dataStream by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual dataStream by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item.DataStreamsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.Item.DataStreamsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual dataStream by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class DataStreamsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateRequest.cs new file mode 100644 index 0000000000..af38053ddf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..d500c4990b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInCreateWriteOnlyChannelRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The isAdultOnly property + public bool? IsAdultOnly + { + get { return BackingStore?.Get("isAdultOnly"); } + set { BackingStore?.Set("isAdultOnly", value); } + } + + /// The isCommercial property + public bool? IsCommercial + { + get { return BackingStore?.Get("isCommercial"); } + set { BackingStore?.Set("isCommercial", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, + { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("isAdultOnly", IsAdultOnly); + writer.WriteBoolValue("isCommercial", IsCommercial); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs new file mode 100644 index 0000000000..4a9f5d811e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInDataStreamResponse.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInDataStreamResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The bytesTransmitted property + public long? BytesTransmitted + { + get { return BackingStore?.Get("bytesTransmitted"); } + set { BackingStore?.Set("bytesTransmitted", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "bytesTransmitted", n => { BytesTransmitted = n.GetLongValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteLongValue("bytesTransmitted", BytesTransmitted); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs new file mode 100644 index 0000000000..bfee76bc49 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The isAdultOnly property + public bool? IsAdultOnly + { + get { return BackingStore?.Get("isAdultOnly"); } + set { BackingStore?.Set("isAdultOnly", value); } + } + + /// The isCommercial property + public bool? IsCommercial + { + get { return BackingStore?.Get("isCommercial"); } + set { BackingStore?.Set("isCommercial", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, + { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("isAdultOnly", IsAdultOnly); + writer.WriteBoolValue("isCommercial", IsCommercial); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs new file mode 100644 index 0000000000..7693212745 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInReadOnlyResourceChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The isAdultOnly property + public bool? IsAdultOnly + { + get { return BackingStore?.Get("isAdultOnly"); } + set { BackingStore?.Set("isAdultOnly", value); } + } + + /// The isCommercial property + public bool? IsCommercial + { + get { return BackingStore?.Get("isCommercial"); } + set { BackingStore?.Set("isCommercial", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, + { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("isAdultOnly", IsAdultOnly); + writer.WriteBoolValue("isCommercial", IsCommercial); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs new file mode 100644 index 0000000000..a239b32c64 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInResponse.cs @@ -0,0 +1,78 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse(), + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs new file mode 100644 index 0000000000..b03000812c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public AttributesInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..58b46afa4a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInUpdateWriteOnlyChannelRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The isAdultOnly property + public bool? IsAdultOnly + { + get { return BackingStore?.Get("isAdultOnly"); } + set { BackingStore?.Set("isAdultOnly", value); } + } + + /// The isCommercial property + public bool? IsCommercial + { + get { return BackingStore?.Get("isCommercial"); } + set { BackingStore?.Set("isCommercial", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, + { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("isAdultOnly", IsAdultOnly); + writer.WriteBoolValue("isCommercial", IsCommercial); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs new file mode 100644 index 0000000000..e9d0d2aa3f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/AttributesInWriteOnlyChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class AttributesInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInResponse, IParsable + #pragma warning restore CS1591 + { + /// The isAdultOnly property + public bool? IsAdultOnly + { + get { return BackingStore?.Get("isAdultOnly"); } + set { BackingStore?.Set("isAdultOnly", value); } + } + + /// The isCommercial property + public bool? IsCommercial + { + get { return BackingStore?.Get("isCommercial"); } + set { BackingStore?.Set("isCommercial", value); } + } + + /// The name property + public string? Name + { + get { return BackingStore?.Get("name"); } + set { BackingStore?.Set("name", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "isAdultOnly", n => { IsAdultOnly = n.GetBoolValue(); } }, + { "isCommercial", n => { IsCommercial = n.GetBoolValue(); } }, + { "name", n => { Name = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteBoolValue("isAdultOnly", IsAdultOnly); + writer.WriteBoolValue("isCommercial", IsCommercial); + writer.WriteStringValue("name", Name); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs new file mode 100644 index 0000000000..dc38870255 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/CreateWriteOnlyChannelRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class CreateWriteOnlyChannelRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public CreateWriteOnlyChannelRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..77478b5490 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInCreateWriteOnlyChannelRequest.cs @@ -0,0 +1,68 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs new file mode 100644 index 0000000000..c139f58730 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInDataStreamResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInDataStreamResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs new file mode 100644 index 0000000000..f58e182a63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyChannelResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs new file mode 100644 index 0000000000..5ab70abf76 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInReadOnlyResourceChannelResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..8972625339 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInUpdateWriteOnlyChannelRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs new file mode 100644 index 0000000000..6ddd971254 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataInWriteOnlyChannelResponse.cs @@ -0,0 +1,86 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse, IParsable + #pragma warning restore CS1591 + { + /// The attributes property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse? Attributes + { + get { return BackingStore?.Get("attributes"); } + set { BackingStore?.Set("attributes", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse? Relationships + { + get { return BackingStore?.Get("relationships"); } + set { BackingStore?.Set("relationships", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "attributes", n => { Attributes = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.AttributesInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks.CreateFromDiscriminatorValue); } }, + { "relationships", n => { Relationships = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("attributes", Attributes); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("relationships", Relationships); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs new file mode 100644 index 0000000000..dd2010b42d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataStreamCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DataStreamCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs new file mode 100644 index 0000000000..f42235a0d9 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierCollectionResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataStreamIdentifierCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DataStreamIdentifierCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs new file mode 100644 index 0000000000..cd7a7ff59b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInRequest.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataStreamIdentifierInRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest, IParsable + #pragma warning restore CS1591 + { + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "id", n => { Id = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteStringValue("id", Id); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs new file mode 100644 index 0000000000..68a87760b8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataStreamIdentifierInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DataStreamIdentifierInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "id", n => { Id = n.GetStringValue(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs new file mode 100644 index 0000000000..5ae636804a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class DataStreamIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public DataStreamIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamResourceType.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamResourceType.cs new file mode 100644 index 0000000000..8e460d0149 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/DataStreamResourceType.cs @@ -0,0 +1,18 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum DataStreamResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "dataStreams")] + #pragma warning disable CS1591 + DataStreams, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorLinks.cs new file mode 100644 index 0000000000..f476915be7 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// The about property + public string? About + { + get { return BackingStore?.Get("about"); } + set { BackingStore?.Set("about", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The type property + public string? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "about", n => { About = n.GetStringValue(); } }, + { "type", n => { Type = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("about", About); + writer.WriteStringValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorObject.cs new file mode 100644 index 0000000000..3cb6a00b41 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorObject.cs @@ -0,0 +1,133 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorObject : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The code property + public string? Code + { + get { return BackingStore?.Get("code"); } + set { BackingStore?.Set("code", value); } + } + + /// The detail property + public string? Detail + { + get { return BackingStore?.Get("detail"); } + set { BackingStore?.Set("detail", value); } + } + + /// The id property + public string? Id + { + get { return BackingStore?.Get("id"); } + set { BackingStore?.Set("id", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The source property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorSource? Source + { + get { return BackingStore?.Get("source"); } + set { BackingStore?.Set("source", value); } + } + + /// The status property + public string? Status + { + get { return BackingStore?.Get("status"); } + set { BackingStore?.Set("status", value); } + } + + /// The title property + public string? Title + { + get { return BackingStore?.Get("title"); } + set { BackingStore?.Set("title", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorObject() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorObject(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "code", n => { Code = n.GetStringValue(); } }, + { "detail", n => { Detail = n.GetStringValue(); } }, + { "id", n => { Id = n.GetStringValue(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "source", n => { Source = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorSource.CreateFromDiscriminatorValue); } }, + { "status", n => { Status = n.GetStringValue(); } }, + { "title", n => { Title = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("code", Code); + writer.WriteStringValue("detail", Detail); + writer.WriteStringValue("id", Id); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + writer.WriteObjectValue("source", Source); + writer.WriteStringValue("status", Status); + writer.WriteStringValue("title", Title); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs new file mode 100644 index 0000000000..2bc9decaeb --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorResponseDocument.cs @@ -0,0 +1,92 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorResponseDocument : ApiException, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The errors property + public List? Errors + { + get { return BackingStore?.Get?>("errors"); } + set { BackingStore?.Set("errors", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The primary error message. + public override string Message { get => base.Message; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "errors", n => { Errors = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorObject.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("errors", Errors); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorSource.cs new file mode 100644 index 0000000000..47814e19f2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorSource.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorSource : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The header property + public string? Header + { + get { return BackingStore?.Get("header"); } + set { BackingStore?.Set("header", value); } + } + + /// The parameter property + public string? Parameter + { + get { return BackingStore?.Get("parameter"); } + set { BackingStore?.Set("parameter", value); } + } + + /// The pointer property + public string? Pointer + { + get { return BackingStore?.Get("pointer"); } + set { BackingStore?.Set("pointer", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorSource() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorSource(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "header", n => { Header = n.GetStringValue(); } }, + { "parameter", n => { Parameter = n.GetStringValue(); } }, + { "pointer", n => { Pointer = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("header", Header); + writer.WriteStringValue("parameter", Parameter); + writer.WriteStringValue("pointer", Pointer); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs new file mode 100644 index 0000000000..c88a314d2b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ErrorTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ErrorTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ErrorTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs new file mode 100644 index 0000000000..bd10e84a5b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/IdentifierInRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class IdentifierInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public IdentifierInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.IdentifierInRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/Meta.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/Meta.cs new file mode 100644 index 0000000000..94ab7f2943 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/Meta.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class Meta : IAdditionalDataHolder, IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + public IDictionary AdditionalData + { + get { return BackingStore.Get>("AdditionalData") ?? new Dictionary(); } + set { BackingStore.Set("AdditionalData", value); } + } + + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// + /// Instantiates a new and sets the default values. + /// + public Meta() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + AdditionalData = new Dictionary(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteAdditionalData(AdditionalData); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs new file mode 100644 index 0000000000..7a0da274db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableDataStreamIdentifierResponseDocument.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableDataStreamIdentifierResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableDataStreamIdentifierResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamIdentifierResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamIdentifierResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs new file mode 100644 index 0000000000..e604e3f280 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableSecondaryDataStreamResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableSecondaryDataStreamResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableSecondaryDataStreamResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs new file mode 100644 index 0000000000..e265d36fd0 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneDataStreamInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneDataStreamInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs new file mode 100644 index 0000000000..61a2e3409f --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/NullableToOneDataStreamInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class NullableToOneDataStreamInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public NullableToOneDataStreamInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs new file mode 100644 index 0000000000..cd2eaa367c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryDataStreamResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryDataStreamResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryDataStreamResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryDataStreamResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs new file mode 100644 index 0000000000..76ab55657b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyChannelResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryReadOnlyChannelResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryReadOnlyChannelResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs new file mode 100644 index 0000000000..2e069325f4 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryReadOnlyResourceChannelResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryReadOnlyResourceChannelResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryReadOnlyResourceChannelResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs new file mode 100644 index 0000000000..c28af81a2d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/PrimaryWriteOnlyChannelResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class PrimaryWriteOnlyChannelResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public PrimaryWriteOnlyChannelResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs new file mode 100644 index 0000000000..91820513d6 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyChannelCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ReadOnlyChannelCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ReadOnlyChannelCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs new file mode 100644 index 0000000000..4f5b4d82c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ReadOnlyResourceChannelCollectionResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ReadOnlyResourceChannelCollectionResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ReadOnlyResourceChannelCollectionResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelCollectionResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelCollectionResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs new file mode 100644 index 0000000000..ffc24e6ed5 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs new file mode 100644 index 0000000000..8362d04cb3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..0ce350dfa1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInCreateWriteOnlyChannelRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInCreateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateRequest, IParsable + #pragma warning restore CS1591 + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest? AudioStreams + { + get { return BackingStore?.Get("audioStreams"); } + set { BackingStore?.Set("audioStreams", value); } + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest? UltraHighDefinitionVideoStream + { + get { return BackingStore?.Get("ultraHighDefinitionVideoStream"); } + set { BackingStore?.Set("ultraHighDefinitionVideoStream", value); } + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest? VideoStream + { + get { return BackingStore?.Get("videoStream"); } + set { BackingStore?.Set("videoStream", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInCreateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest.CreateFromDiscriminatorValue); } }, + { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, + { "videoStream", n => { VideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("audioStreams", AudioStreams); + writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); + writer.WriteObjectValue("videoStream", VideoStream); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs new file mode 100644 index 0000000000..5c79ba3972 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInReadOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse? AudioStreams + { + get { return BackingStore?.Get("audioStreams"); } + set { BackingStore?.Set("audioStreams", value); } + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream + { + get { return BackingStore?.Get("ultraHighDefinitionVideoStream"); } + set { BackingStore?.Set("ultraHighDefinitionVideoStream", value); } + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse? VideoStream + { + get { return BackingStore?.Get("videoStream"); } + set { BackingStore?.Set("videoStream", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "videoStream", n => { VideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("audioStreams", AudioStreams); + writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); + writer.WriteObjectValue("videoStream", VideoStream); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs new file mode 100644 index 0000000000..689da3eb21 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInReadOnlyResourceChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInReadOnlyResourceChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse? AudioStreams + { + get { return BackingStore?.Get("audioStreams"); } + set { BackingStore?.Set("audioStreams", value); } + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream + { + get { return BackingStore?.Get("ultraHighDefinitionVideoStream"); } + set { BackingStore?.Set("ultraHighDefinitionVideoStream", value); } + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse? VideoStream + { + get { return BackingStore?.Get("videoStream"); } + set { BackingStore?.Set("videoStream", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "videoStream", n => { VideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("audioStreams", AudioStreams); + writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); + writer.WriteObjectValue("videoStream", VideoStream); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs new file mode 100644 index 0000000000..787b6582c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs new file mode 100644 index 0000000000..455267e937 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateRequest.cs @@ -0,0 +1,75 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The openapiDiscriminator property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? OpenapiDiscriminator + { + get { return BackingStore?.Get("openapi:discriminator"); } + set { BackingStore?.Set("openapi:discriminator", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public RelationshipsInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("openapi:discriminator")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "openapi:discriminator", n => { OpenapiDiscriminator = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteEnumValue("openapi:discriminator", OpenapiDiscriminator); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs new file mode 100644 index 0000000000..cf520fbe85 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInUpdateWriteOnlyChannelRequest.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInUpdateWriteOnlyChannelRequest : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateRequest, IParsable + #pragma warning restore CS1591 + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest? AudioStreams + { + get { return BackingStore?.Get("audioStreams"); } + set { BackingStore?.Set("audioStreams", value); } + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest? UltraHighDefinitionVideoStream + { + get { return BackingStore?.Get("ultraHighDefinitionVideoStream"); } + set { BackingStore?.Set("ultraHighDefinitionVideoStream", value); } + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest? VideoStream + { + get { return BackingStore?.Get("videoStream"); } + set { BackingStore?.Set("videoStream", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInUpdateWriteOnlyChannelRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest.CreateFromDiscriminatorValue); } }, + { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, + { "videoStream", n => { VideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("audioStreams", AudioStreams); + writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); + writer.WriteObjectValue("videoStream", VideoStream); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs new file mode 100644 index 0000000000..f46ec749de --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/RelationshipsInWriteOnlyChannelResponse.cs @@ -0,0 +1,77 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class RelationshipsInWriteOnlyChannelResponse : global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInResponse, IParsable + #pragma warning restore CS1591 + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse? AudioStreams + { + get { return BackingStore?.Get("audioStreams"); } + set { BackingStore?.Set("audioStreams", value); } + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse? UltraHighDefinitionVideoStream + { + get { return BackingStore?.Get("ultraHighDefinitionVideoStream"); } + set { BackingStore?.Set("ultraHighDefinitionVideoStream", value); } + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse? VideoStream + { + get { return BackingStore?.Get("videoStream"); } + set { BackingStore?.Set("videoStream", value); } + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipsInWriteOnlyChannelResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public override IDictionary> GetFieldDeserializers() + { + return new Dictionary>(base.GetFieldDeserializers()) + { + { "audioStreams", n => { AudioStreams = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "ultraHighDefinitionVideoStream", n => { UltraHighDefinitionVideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + { "videoStream", n => { VideoStream = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public override void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + base.Serialize(writer); + writer.WriteObjectValue("audioStreams", AudioStreams); + writer.WriteObjectValue("ultraHighDefinitionVideoStream", UltraHighDefinitionVideoStream); + writer.WriteObjectValue("videoStream", VideoStream); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..34acd5ed32 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceCollectionTopLevelLinks.cs @@ -0,0 +1,115 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs new file mode 100644 index 0000000000..2ec89ef5ef --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierCollectionTopLevelLinks.cs @@ -0,0 +1,124 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierCollectionTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The first property + public string? First + { + get { return BackingStore?.Get("first"); } + set { BackingStore?.Set("first", value); } + } + + /// The last property + public string? Last + { + get { return BackingStore?.Get("last"); } + set { BackingStore?.Set("last", value); } + } + + /// The next property + public string? Next + { + get { return BackingStore?.Get("next"); } + set { BackingStore?.Set("next", value); } + } + + /// The prev property + public string? Prev + { + get { return BackingStore?.Get("prev"); } + set { BackingStore?.Set("prev", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierCollectionTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierCollectionTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "first", n => { First = n.GetStringValue(); } }, + { "last", n => { Last = n.GetStringValue(); } }, + { "next", n => { Next = n.GetStringValue(); } }, + { "prev", n => { Prev = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("first", First); + writer.WriteStringValue("last", Last); + writer.WriteStringValue("next", Next); + writer.WriteStringValue("prev", Prev); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs new file mode 100644 index 0000000000..5b9950d800 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceIdentifierTopLevelLinks.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceIdentifierTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The related property + public string? Related + { + get { return BackingStore?.Get("related"); } + set { BackingStore?.Set("related", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceIdentifierTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceIdentifierTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "related", n => { Related = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("related", Related); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs new file mode 100644 index 0000000000..dae9e59575 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInCreateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInCreateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInCreateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInCreateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInCreateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs new file mode 100644 index 0000000000..ce97d6a1c8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInResponse.cs @@ -0,0 +1,87 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "dataStreams" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse(), + "readOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyChannelResponse(), + "readOnlyResourceChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInReadOnlyResourceChannelResponse(), + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInWriteOnlyChannelResponse(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs new file mode 100644 index 0000000000..395a5e9419 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceInUpdateRequest.cs @@ -0,0 +1,84 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceInUpdateRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// The type property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceType? Type + { + get { return BackingStore?.Get("type"); } + set { BackingStore?.Set("type", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceInUpdateRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + var mappingValue = parseNode.GetChildNode("type")?.GetStringValue(); + return mappingValue switch + { + "writeOnlyChannels" => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest(), + _ => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInUpdateRequest(), + }; + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + { "type", n => { Type = n.GetEnumValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("meta", Meta); + writer.WriteEnumValue("type", Type); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs new file mode 100644 index 0000000000..857cfd5557 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceLinks.cs @@ -0,0 +1,70 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs new file mode 100644 index 0000000000..9ebe742c04 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceTopLevelLinks.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ResourceTopLevelLinks : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The describedby property + public string? Describedby + { + get { return BackingStore?.Get("describedby"); } + set { BackingStore?.Set("describedby", value); } + } + + /// The self property + public string? Self + { + get { return BackingStore?.Get("self"); } + set { BackingStore?.Set("self", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ResourceTopLevelLinks() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "describedby", n => { Describedby = n.GetStringValue(); } }, + { "self", n => { Self = n.GetStringValue(); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteStringValue("describedby", Describedby); + writer.WriteStringValue("self", Self); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs new file mode 100644 index 0000000000..27d51220ab --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ResourceType.cs @@ -0,0 +1,30 @@ +// +#nullable enable +#pragma warning disable CS8625 +using System.Runtime.Serialization; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public enum ResourceType + #pragma warning restore CS1591 + { + [EnumMember(Value = "dataStreams")] + #pragma warning disable CS1591 + DataStreams, + #pragma warning restore CS1591 + [EnumMember(Value = "readOnlyChannels")] + #pragma warning disable CS1591 + ReadOnlyChannels, + #pragma warning restore CS1591 + [EnumMember(Value = "readOnlyResourceChannels")] + #pragma warning disable CS1591 + ReadOnlyResourceChannels, + #pragma warning restore CS1591 + [EnumMember(Value = "writeOnlyChannels")] + #pragma warning disable CS1591 + WriteOnlyChannels, + #pragma warning restore CS1591 + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs new file mode 100644 index 0000000000..6314c4e2e2 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/SecondaryDataStreamResponseDocument.cs @@ -0,0 +1,97 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class SecondaryDataStreamResponseDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The included property + public List? Included + { + get { return BackingStore?.Get?>("included"); } + set { BackingStore?.Set("included", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public SecondaryDataStreamResponseDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInDataStreamResponse.CreateFromDiscriminatorValue); } }, + { "included", n => { Included = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ResourceTopLevelLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteCollectionOfObjectValues("included", Included); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs new file mode 100644 index 0000000000..7ecfdcb19d --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyDataStreamInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyDataStreamInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue)?.AsList(); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs new file mode 100644 index 0000000000..928ff49881 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToManyDataStreamInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToManyDataStreamInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public List? Data + { + get { return BackingStore?.Get?>("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToManyDataStreamInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetCollectionOfObjectValues(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue)?.AsList(); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteCollectionOfObjectValues("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs new file mode 100644 index 0000000000..d1528a2617 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInRequest.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneDataStreamInRequest : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneDataStreamInRequest() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs new file mode 100644 index 0000000000..cb92f96da3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/ToOneDataStreamInResponse.cs @@ -0,0 +1,88 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class ToOneDataStreamInResponse : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The links property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks? Links + { + get { return BackingStore?.Get("links"); } + set { BackingStore?.Set("links", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public ToOneDataStreamInResponse() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInResponse(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierInResponse.CreateFromDiscriminatorValue); } }, + { "links", n => { Links = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.RelationshipLinks.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("links", Links); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs new file mode 100644 index 0000000000..2ee1033f63 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/Models/UpdateWriteOnlyChannelRequestDocument.cs @@ -0,0 +1,79 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions.Store; +using System.Collections.Generic; +using System.IO; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models +{ + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + #pragma warning disable CS1591 + public partial class UpdateWriteOnlyChannelRequestDocument : IBackedModel, IParsable + #pragma warning restore CS1591 + { + /// Stores model information. + public IBackingStore BackingStore { get; private set; } + + /// The data property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest? Data + { + get { return BackingStore?.Get("data"); } + set { BackingStore?.Set("data", value); } + } + + /// The meta property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta? Meta + { + get { return BackingStore?.Get("meta"); } + set { BackingStore?.Set("meta", value); } + } + + /// + /// Instantiates a new and sets the default values. + /// + public UpdateWriteOnlyChannelRequestDocument() + { + BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore(); + } + + /// + /// Creates a new instance of the appropriate class based on discriminator value + /// + /// A + /// The parse node to use to read the discriminator value and create the object + public static global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument CreateFromDiscriminatorValue(IParseNode parseNode) + { + _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode)); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument(); + } + + /// + /// The deserialization information for the current model + /// + /// A IDictionary<string, Action<IParseNode>> + public virtual IDictionary> GetFieldDeserializers() + { + return new Dictionary> + { + { "data", n => { Data = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataInUpdateWriteOnlyChannelRequest.CreateFromDiscriminatorValue); } }, + { "meta", n => { Meta = n.GetObjectValue(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.Meta.CreateFromDiscriminatorValue); } }, + }; + } + + /// + /// Serializes information the current object + /// + /// Serialization writer to use to serialize this model + public virtual void Serialize(ISerializationWriter writer) + { + _ = writer ?? throw new ArgumentNullException(nameof(writer)); + writer.WriteObjectValue("data", Data); + writer.WriteObjectValue("meta", Meta); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs new file mode 100644 index 0000000000..2d07d91395 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\audioStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/audioStreams{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/audioStreams{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyChannel's audioStreams relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyChannel's audioStreams relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams.AudioStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams.AudioStreamsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyChannel's audioStreams relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/ReadOnlyChannelsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/ReadOnlyChannelsItemRequestBuilder.cs new file mode 100644 index 0000000000..a2fd224a9c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/ReadOnlyChannelsItemRequestBuilder.cs @@ -0,0 +1,156 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsItemRequestBuilder : BaseRequestBuilder + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams.AudioStreamsRequestBuilder AudioStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.AudioStreams.AudioStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder UltraHighDefinitionVideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream.VideoStreamRequestBuilder VideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream.VideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ReadOnlyChannelsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ReadOnlyChannelsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}{?query*}", rawUrl) + { + } + + /// + /// Retrieves an individual readOnlyChannel by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual readOnlyChannel by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.ReadOnlyChannelsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.ReadOnlyChannelsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual readOnlyChannel by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs new file mode 100644 index 0000000000..791f245a90 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\relationships\audioStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/audioStreams{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/audioStreams{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream identities of an individual readOnlyChannel's audioStreams relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identities of an individual readOnlyChannel's audioStreams relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identities of an individual readOnlyChannel's audioStreams relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..984e7109db --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder AudioStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder UltraHighDefinitionVideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder VideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..6ef507aaa3 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\relationships\ultraHighDefinitionVideoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..86c101ef24 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\relationships\videoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/videoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/relationships/videoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's videoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's videoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identity of an individual readOnlyChannel's videoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..919369dde1 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\ultraHighDefinitionVideoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/ultraHighDefinitionVideoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/ultraHighDefinitionVideoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/VideoStream/VideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/VideoStream/VideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..75950fccaa --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/Item/VideoStream/VideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels\{id}\videoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/videoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels/{id}/videoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream.VideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.VideoStream.VideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/ReadOnlyChannelsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/ReadOnlyChannelsRequestBuilder.cs new file mode 100644 index 0000000000..33f9ab8a74 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyChannels/ReadOnlyChannelsRequestBuilder.cs @@ -0,0 +1,140 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels +{ + /// + /// Builds and executes requests for operations under \readOnlyChannels + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.readOnlyChannels.item collection + /// The identifier of the readOnlyChannel to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.ReadOnlyChannelsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.Item.ReadOnlyChannelsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ReadOnlyChannelsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ReadOnlyChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyChannels{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of readOnlyChannels. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyChannelCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of readOnlyChannels. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.ReadOnlyChannelsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.ReadOnlyChannelsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of readOnlyChannels. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyChannelsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs new file mode 100644 index 0000000000..53cac43c79 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/AudioStreams/AudioStreamsRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams +{ + /// + /// Builds and executes requests for operations under \readOnlyResourceChannels\{id}\audioStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/audioStreams{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/audioStreams{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyResourceChannel's audioStreams relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyResourceChannel's audioStreams relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams.AudioStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams.AudioStreamsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStreams of an individual readOnlyResourceChannel's audioStreams relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/ReadOnlyResourceChannelsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/ReadOnlyResourceChannelsItemRequestBuilder.cs new file mode 100644 index 0000000000..56dc09df25 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/ReadOnlyResourceChannelsItemRequestBuilder.cs @@ -0,0 +1,149 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item +{ + /// + /// Builds and executes requests for operations under \readOnlyResourceChannels\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsItemRequestBuilder : BaseRequestBuilder + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams.AudioStreamsRequestBuilder AudioStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.AudioStreams.AudioStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder UltraHighDefinitionVideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream.VideoStreamRequestBuilder VideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream.VideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ReadOnlyResourceChannelsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ReadOnlyResourceChannelsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}{?query*}", rawUrl) + { + } + + /// + /// Retrieves an individual readOnlyResourceChannel by its identifier. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryReadOnlyResourceChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an individual readOnlyResourceChannel by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.ReadOnlyResourceChannelsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.ReadOnlyResourceChannelsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves an individual readOnlyResourceChannel by its identifier. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsItemRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsItemRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..69411ac0e8 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyResourceChannels\{id}\ultraHighDefinitionVideoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/ultraHighDefinitionVideoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/ultraHighDefinitionVideoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableSecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/VideoStream/VideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/VideoStream/VideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..2b199a5fed --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/Item/VideoStream/VideoStreamRequestBuilder.cs @@ -0,0 +1,128 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream +{ + /// + /// Builds and executes requests for operations under \readOnlyResourceChannels\{id}\videoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/videoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels/{id}/videoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.SecondaryDataStreamResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream.VideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.VideoStream.VideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/ReadOnlyResourceChannelsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/ReadOnlyResourceChannelsRequestBuilder.cs new file mode 100644 index 0000000000..5ee482011c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/ReadOnlyResourceChannels/ReadOnlyResourceChannelsRequestBuilder.cs @@ -0,0 +1,140 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels +{ + /// + /// Builds and executes requests for operations under \readOnlyResourceChannels + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.readOnlyResourceChannels.item collection + /// The identifier of the readOnlyResourceChannel to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.ReadOnlyResourceChannelsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.Item.ReadOnlyResourceChannelsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ReadOnlyResourceChannelsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ReadOnlyResourceChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/readOnlyResourceChannels{?query*}", rawUrl) + { + } + + /// + /// Retrieves a collection of readOnlyResourceChannels. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ReadOnlyResourceChannelCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a collection of readOnlyResourceChannels. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.ReadOnlyResourceChannelsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.ReadOnlyResourceChannelsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves a collection of readOnlyResourceChannels. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class ReadOnlyResourceChannelsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/RelationshipChannelsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/RelationshipChannelsItemRequestBuilder.cs new file mode 100644 index 0000000000..d4e397d3ac --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/RelationshipChannelsItemRequestBuilder.cs @@ -0,0 +1,45 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item +{ + /// + /// Builds and executes requests for operations under \relationshipChannels\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipChannelsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipChannelsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipChannelsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs new file mode 100644 index 0000000000..cfc146b291 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs @@ -0,0 +1,248 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams +{ + /// + /// Builds and executes requests for operations under \relationshipChannels\{id}\relationships\audioStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/audioStreams{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/audioStreams{?query*}", rawUrl) + { + } + + /// + /// Removes existing dataStreams from the audioStreams relationship of an individual relationshipChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identities of an individual relationshipChannel's audioStreams relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierCollectionResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing dataStreams to the audioStreams relationship of an individual relationshipChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing dataStreams to the audioStreams relationship of an individual relationshipChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing dataStreams from the audioStreams relationship of an individual relationshipChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Retrieves the related dataStream identities of an individual relationshipChannel's audioStreams relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns existing dataStreams to the audioStreams relationship of an individual relationshipChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing dataStreams to the audioStreams relationship of an individual relationshipChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identities of an individual relationshipChannel's audioStreams relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..cad98da8bf --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \relationshipChannels\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder AudioStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder UltraHighDefinitionVideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder VideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..6f7c00a048 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream +{ + /// + /// Builds and executes requests for operations under \relationshipChannels\{id}\relationships\ultraHighDefinitionVideoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/ultraHighDefinitionVideoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/ultraHighDefinitionVideoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableDataStreamIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual relationshipChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's ultraHighDefinitionVideoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual relationshipChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's ultraHighDefinitionVideoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..56f8d6974c --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs @@ -0,0 +1,168 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream +{ + /// + /// Builds and executes requests for operations under \relationshipChannels\{id}\relationships\videoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/videoStream{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels/{id}/relationships/videoStream{?query*}", rawUrl) + { + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's videoStream relationship. + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.DataStreamIdentifierResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + public async Task HeadAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToHeadRequestInformation(requestConfiguration); + await RequestAdapter.SendNoContentAsync(requestInfo, default, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing dataStream to the videoStream relationship of an individual relationshipChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's videoStream relationship. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToHeadRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.HEAD, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + return requestInfo; + } + + /// + /// Assigns an existing dataStream to the videoStream relationship of an individual relationshipChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Retrieves the related dataStream identity of an individual relationshipChannel's videoStream relationship. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderGetQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + + /// + /// Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilderHeadQueryParameters + { + /// For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/RelationshipChannelsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/RelationshipChannelsRequestBuilder.cs new file mode 100644 index 0000000000..fb78208eee --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RelationshipChannels/RelationshipChannelsRequestBuilder.cs @@ -0,0 +1,52 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels +{ + /// + /// Builds and executes requests for operations under \relationshipChannels + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipChannelsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.relationshipChannels.item collection + /// The identifier of the relationshipChannel whose related dataStream identities to retrieve. + /// A + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.RelationshipChannelsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.Item.RelationshipChannelsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipChannelsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/relationshipChannels", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RestrictedControllersClient.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RestrictedControllersClient.cs new file mode 100644 index 0000000000..3ae5195a54 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/RestrictedControllersClient.cs @@ -0,0 +1,82 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Store; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Serialization.Form; +using Microsoft.Kiota.Serialization.Json; +using Microsoft.Kiota.Serialization.Multipart; +using Microsoft.Kiota.Serialization.Text; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode +{ + /// + /// The main entry point of the SDK, exposes the configuration and the fluent API. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RestrictedControllersClient : BaseRequestBuilder + { + /// The dataStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.DataStreamsRequestBuilder DataStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.DataStreams.DataStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The readOnlyChannels property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.ReadOnlyChannelsRequestBuilder ReadOnlyChannels + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyChannels.ReadOnlyChannelsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The readOnlyResourceChannels property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.ReadOnlyResourceChannelsRequestBuilder ReadOnlyResourceChannels + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.ReadOnlyResourceChannels.ReadOnlyResourceChannelsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The relationshipChannels property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.RelationshipChannelsRequestBuilder RelationshipChannels + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.RelationshipChannels.RelationshipChannelsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The writeOnlyChannels property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.WriteOnlyChannelsRequestBuilder WriteOnlyChannels + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.WriteOnlyChannelsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The backing store to use for the models. + /// The request adapter to use to execute the requests. + public RestrictedControllersClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary()) + { + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultSerializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + ApiClientBuilder.RegisterDefaultDeserializer(); + if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) + { + RequestAdapter.BaseUrl = "http://localhost"; + } + PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl); + RequestAdapter.EnableBackingStore(backingStore); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs new file mode 100644 index 0000000000..532ecb788a --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/AudioStreams/AudioStreamsRequestBuilder.cs @@ -0,0 +1,171 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels\{id}\relationships\audioStreams + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class AudioStreamsRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/audioStreams", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public AudioStreamsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/audioStreams", rawUrl) + { + } + + /// + /// Removes existing dataStreams from the audioStreams relationship of an individual writeOnlyChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task DeleteAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToDeleteRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes existing dataStreams from the audioStreams relationship of an individual writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Assigns existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Adds existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToManyDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs new file mode 100644 index 0000000000..c5b04aaa43 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/RelationshipsRequestBuilder.cs @@ -0,0 +1,59 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels\{id}\relationships + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class RelationshipsRequestBuilder : BaseRequestBuilder + { + /// The audioStreams property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder AudioStreams + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.AudioStreams.AudioStreamsRequestBuilder(PathParameters, RequestAdapter); + } + + /// The ultraHighDefinitionVideoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder UltraHighDefinitionVideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// The videoStream property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder VideoStream + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public RelationshipsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships", rawUrl) + { + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..ad24e4691e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/UltraHighDefinitionVideoStream/UltraHighDefinitionVideoStreamRequestBuilder.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels\{id}\relationships\ultraHighDefinitionVideoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class UltraHighDefinitionVideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public UltraHighDefinitionVideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream", rawUrl) + { + } + + /// + /// Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual writeOnlyChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.NullableToOneDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.UltraHighDefinitionVideoStream.UltraHighDefinitionVideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs new file mode 100644 index 0000000000..da71988d09 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/Relationships/VideoStream/VideoStreamRequestBuilder.cs @@ -0,0 +1,91 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels\{id}\relationships\videoStream + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class VideoStreamRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/videoStream", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public VideoStreamRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}/relationships/videoStream", rawUrl) + { + } + + /// + /// Assigns an existing dataStream to the videoStream relationship of an individual writeOnlyChannel. + /// + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Assigns an existing dataStream to the videoStream relationship of an individual writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ToOneDataStreamInRequest body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.VideoStream.VideoStreamRequestBuilder(rawUrl, RequestAdapter); + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/WriteOnlyChannelsItemRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/WriteOnlyChannelsItemRequestBuilder.cs new file mode 100644 index 0000000000..2e324e4622 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/Item/WriteOnlyChannelsItemRequestBuilder.cs @@ -0,0 +1,139 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels\{id} + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class WriteOnlyChannelsItemRequestBuilder : BaseRequestBuilder + { + /// The relationships property + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.RelationshipsRequestBuilder Relationships + { + get => new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.Relationships.RelationshipsRequestBuilder(PathParameters, RequestAdapter); + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public WriteOnlyChannelsItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public WriteOnlyChannelsItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels/{id}{?query*}", rawUrl) + { + } + + /// + /// Deletes an existing writeOnlyChannel by its identifier. + /// + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code + public async Task DeleteAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + var requestInfo = ToDeleteRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + await RequestAdapter.SendNoContentAsync(requestInfo, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing writeOnlyChannel. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PatchAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPatchRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing writeOnlyChannel by its identifier. + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToDeleteRequestInformation(Action>? requestConfiguration = default) + { + var requestInfo = new RequestInformation(Method.DELETE, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + return requestInfo; + } + + /// + /// Updates an existing writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPatchRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.UpdateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.PATCH, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.WriteOnlyChannelsItemRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.WriteOnlyChannelsItemRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Updates an existing writeOnlyChannel. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class WriteOnlyChannelsItemRequestBuilderPatchQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/WriteOnlyChannelsRequestBuilder.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/WriteOnlyChannelsRequestBuilder.cs new file mode 100644 index 0000000000..b50d4ec156 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/GeneratedCode/WriteOnlyChannels/WriteOnlyChannelsRequestBuilder.cs @@ -0,0 +1,119 @@ +// +#nullable enable +#pragma warning disable CS8625 +#pragma warning disable CS0618 +using Microsoft.Kiota.Abstractions.Extensions; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels +{ + /// + /// Builds and executes requests for operations under \writeOnlyChannels + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class WriteOnlyChannelsRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.writeOnlyChannels.item collection + /// The identifier of the writeOnlyChannel to update. + /// A + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.WriteOnlyChannelsItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("id", position); + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.Item.WriteOnlyChannelsItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public WriteOnlyChannelsRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels{?query*}", pathParameters) + { + } + + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public WriteOnlyChannelsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/writeOnlyChannels{?query*}", rawUrl) + { + } + + /// + /// Creates a new writeOnlyChannel. + /// + /// A + /// The request body + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 400 status code + /// When receiving a 403 status code + /// When receiving a 404 status code + /// When receiving a 409 status code + /// When receiving a 422 status code + public async Task PostAsync(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = ToPostRequestInformation(body, requestConfiguration); + var errorMapping = new Dictionary> + { + { "400", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "403", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "404", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "409", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + { "422", global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.ErrorResponseDocument.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.PrimaryWriteOnlyChannelResponseDocument.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new writeOnlyChannel. + /// + /// A + /// The request body + /// Configuration for the request such as headers, query parameters, and middleware options. + public RequestInformation ToPostRequestInformation(global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models.CreateWriteOnlyChannelRequestDocument body, Action>? requestConfiguration = default) + { + _ = body ?? throw new ArgumentNullException(nameof(body)); + var requestInfo = new RequestInformation(Method.POST, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/vnd.api+json;ext=openapi"); + requestInfo.SetContentFromParsable(RequestAdapter, "application/vnd.api+json;ext=openapi", body); + return requestInfo; + } + + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.WriteOnlyChannelsRequestBuilder WithUrl(string rawUrl) + { + return new global::OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.WriteOnlyChannels.WriteOnlyChannelsRequestBuilder(rawUrl, RequestAdapter); + } + + /// + /// Creates a new writeOnlyChannel. + /// + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")] + public partial class WriteOnlyChannelsRequestBuilderPostQueryParameters + { + /// For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters. + [QueryParameter("query")] + public string? Query { get; set; } + } + } +} +#pragma warning restore CS0618 diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs new file mode 100644 index 0000000000..7be939449b --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs @@ -0,0 +1,406 @@ +using System.Net; +using FluentAssertions; +using Microsoft.EntityFrameworkCore; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class UpdateRelationshipTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public UpdateRelationshipTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_replace_ToOne_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingVideoStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new NullableToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingVideoStream.StringId! + } + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.UltraHighDefinitionVideoStream.PatchAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.UltraHighDefinitionVideoStream) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channelInDatabase.UltraHighDefinitionVideoStream.Id.Should().Be(existingVideoStream.Id); + }); + } + + [Fact] + public async Task Can_clear_ToOne_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new NullableToOneDataStreamInRequest + { + Data = null + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.UltraHighDefinitionVideoStream.PatchAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.UltraHighDefinitionVideoStream) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.UltraHighDefinitionVideoStream.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_replace_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingAudioStream.StringId! + } + ] + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.AudioStreams.PatchAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingAudioStream.Id); + }); + } + + [Fact] + public async Task Can_clear_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new ToManyDataStreamInRequest + { + Data = [] + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.AudioStreams.PatchAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_add_to_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(1); + + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingAudioStream.StringId! + } + ] + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.AudioStreams.PostAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(2); + channelInDatabase.AudioStreams.Should().ContainSingle(stream => stream.Id == existingChannel.AudioStreams.ElementAt(0).Id); + channelInDatabase.AudioStreams.Should().ContainSingle(stream => stream.Id == existingAudioStream.Id); + }); + } + + [Fact] + public async Task Can_remove_from_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingChannel.AudioStreams.ElementAt(0).StringId! + }, + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingChannel.AudioStreams.ElementAt(1).StringId! + } + ] + }; + + // Act + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.AudioStreams.DeleteAsync(requestBody); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingChannel.AudioStreams.ElementAt(2).Id); + }); + } + + [Fact] + public async Task Cannot_update_relationship_for_missing_request_body() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + NullableToOneDataStreamInRequest requestBody = null!; + + // Act + Func action = async () => + await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.UltraHighDefinitionVideoStream.PatchAsync(requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_update_relationship_with_unknown_relationship_IDs() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + string unknownAudioStreamId1 = Unknown.StringId.For(); + string unknownAudioStreamId2 = Unknown.StringId.AltFor(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = unknownAudioStreamId1 + }, + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = unknownAudioStreamId2 + } + ] + }; + + // Act + Func action = async () => await apiClient.WriteOnlyChannels[existingChannel.StringId!].Relationships.AudioStreams.PatchAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(2); + + ErrorObject error1 = exception.Errors.ElementAt(0); + error1.Status.Should().Be("404"); + error1.Title.Should().Be("A related resource does not exist."); + error1.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownAudioStreamId1}' in relationship 'audioStreams' does not exist."); + + ErrorObject error2 = exception.Errors.ElementAt(1); + error2.Status.Should().Be("404"); + error2.Title.Should().Be("A related resource does not exist."); + error2.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownAudioStreamId2}' in relationship 'audioStreams' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs new file mode 100644 index 0000000000..9c20a8db4e --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -0,0 +1,318 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Kiota.Http.HttpClientLibrary; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode.Models; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests.RestrictedControllers; + +public sealed class UpdateResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly TestableHttpClientRequestAdapterFactory _requestAdapterFactory; + private readonly RestrictionFakers _fakers = new(); + + public UpdateResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _requestAdapterFactory = new TestableHttpClientRequestAdapterFactory(testOutputHelper); + + testContext.UseController(); + + testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>))); + } + + [Fact] + public async Task Can_update_resource_with_includes_and_fieldsets() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + string? newChannelName = _fakers.WriteOnlyChannel.GenerateOne().Name; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingVideoStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Type = ResourceType.WriteOnlyChannels, + Id = existingChannel.StringId!, + Attributes = new AttributesInUpdateWriteOnlyChannelRequest + { + Name = newChannelName + }, + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = existingVideoStream.StringId! + } + }, + UltraHighDefinitionVideoStream = new NullableToOneDataStreamInRequest + { + Data = null + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = [] + } + } + } + }; + + using IDisposable scope = _requestAdapterFactory.WithQueryString(new Dictionary + { + ["include"] = "videoStream,audioStreams", + ["fields[writeOnlyChannels]"] = "name,isCommercial,videoStream,audioStreams", + ["fields[dataStreams]"] = "bytesTransmitted" + }); + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(existingChannel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(newChannelName); + response.Data.Attributes.IsCommercial.Should().Be(existingChannel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().BeNull(); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Id.Should().Be(existingVideoStream.StringId); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); + + response.Included.Should().HaveCount(1); + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.UltraHighDefinitionVideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(newChannelName); + channelInDatabase.IsCommercial.Should().Be(existingChannel.IsCommercial); + channelInDatabase.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingVideoStream.Id); + + channelInDatabase.UltraHighDefinitionVideoStream.Should().BeNull(); + + channelInDatabase.AudioStreams.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_resource_without_attributes_or_relationships() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Type = ResourceType.WriteOnlyChannels, + Id = existingChannel.StringId!, + Attributes = new AttributesInUpdateWriteOnlyChannelRequest(), + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest() + } + }; + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(existingChannel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(existingChannel.Name); + response.Data.Attributes.IsCommercial.Should().Be(existingChannel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().BeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.UltraHighDefinitionVideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(existingChannel.Name); + channelInDatabase.IsCommercial.Should().Be(existingChannel.IsCommercial); + channelInDatabase.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingChannel.VideoStream.Id); + + channelInDatabase.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channelInDatabase.UltraHighDefinitionVideoStream.Id.Should().Be(existingChannel.UltraHighDefinitionVideoStream.Id); + + channelInDatabase.AudioStreams.Should().HaveCount(2); + }); + } + + [Fact] + public async Task Cannot_update_resource_for_missing_request_body() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + UpdateWriteOnlyChannelRequestDocument requestBody = null!; + + // Act + Func action = async () => _ = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_update_resource_with_unknown_relationship_IDs() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + string unknownDataStreamId = Unknown.StringId.For(); + + using HttpClientRequestAdapter requestAdapter = _requestAdapterFactory.CreateAdapter(_testContext.Factory); + var apiClient = new RestrictedControllersClient(requestAdapter); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Type = ResourceType.WriteOnlyChannels, + Id = existingChannel.StringId!, + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = unknownDataStreamId + } + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Type = ResourceType.DataStreams, + Id = unknownDataStreamId + } + ] + } + } + } + }; + + // Act + Func action = async () => _ = await apiClient.WriteOnlyChannels[existingChannel.StringId!].PatchAsync(requestBody); + + // Assert + ErrorResponseDocument exception = (await action.Should().ThrowExactlyAsync()).Which; + exception.ResponseStatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be($"Exception of type '{typeof(ErrorResponseDocument).FullName}' was thrown."); + exception.Errors.Should().HaveCount(2); + + ErrorObject error1 = exception.Errors.ElementAt(0); + error1.Status.Should().Be("404"); + error1.Title.Should().Be("A related resource does not exist."); + error1.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownDataStreamId}' in relationship 'audioStreams' does not exist."); + + ErrorObject error2 = exception.Errors.ElementAt(1); + error2.Status.Should().Be("404"); + error2.Title.Should().Be("A related resource does not exist."); + error2.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownDataStreamId}' in relationship 'videoStream' does not exist."); + } + + public void Dispose() + { + _requestAdapterFactory.Dispose(); + } +} diff --git a/test/OpenApiKiotaEndToEndTests/TestableHttpClientRequestAdapterFactory.cs b/test/OpenApiKiotaEndToEndTests/TestableHttpClientRequestAdapterFactory.cs new file mode 100644 index 0000000000..0ce536d479 --- /dev/null +++ b/test/OpenApiKiotaEndToEndTests/TestableHttpClientRequestAdapterFactory.cs @@ -0,0 +1,45 @@ +using JsonApiDotNetCore.OpenApi.Client.Kiota; +using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.Kiota.Abstractions.Authentication; +using Microsoft.Kiota.Http.HttpClientLibrary; +using TestBuildingBlocks; +using Xunit.Abstractions; + +namespace OpenApiKiotaEndToEndTests; + +internal sealed class TestableHttpClientRequestAdapterFactory : IDisposable +{ + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly SetQueryStringHttpMessageHandler _queryStringMessageHandler = new(); + + public TestableHttpClientRequestAdapterFactory(ITestOutputHelper testOutputHelper) + { + ArgumentNullException.ThrowIfNull(testOutputHelper); + + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + } + + public HttpClientRequestAdapter CreateAdapter(WebApplicationFactory webApplicationFactory) + where TStartup : class + { + ArgumentNullException.ThrowIfNull(webApplicationFactory); + + IList delegatingHandlers = KiotaClientFactory.CreateDefaultHandlers(); + delegatingHandlers.Add(_queryStringMessageHandler); + delegatingHandlers.Add(_logHttpMessageHandler); + HttpClient httpClient = webApplicationFactory.CreateDefaultClient(delegatingHandlers.ToArray()); + + return new HttpClientRequestAdapter(new AnonymousAuthenticationProvider(), httpClient: httpClient); + } + + public IDisposable WithQueryString(IDictionary queryString) + { + return _queryStringMessageHandler.CreateScope(queryString); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + _queryStringMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagClientTests/.editorconfig b/test/OpenApiNSwagClientTests/.editorconfig new file mode 100644 index 0000000000..e2ec1cac44 --- /dev/null +++ b/test/OpenApiNSwagClientTests/.editorconfig @@ -0,0 +1,3 @@ +# Workaround for incorrect nullability in NSwag generated clients. +[*Client.cs] +dotnet_diagnostic.CS8765.severity = none diff --git a/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs b/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs new file mode 100644 index 0000000000..aa73b81824 --- /dev/null +++ b/test/OpenApiNSwagClientTests/BaseOpenApiNSwagClientTests.cs @@ -0,0 +1,72 @@ +using System.Reflection; + +namespace OpenApiNSwagClientTests; + +public abstract class BaseOpenApiNSwagClientTests +{ + /// + /// Sets the property on the specified source to its default value (null for string, 0 for int, false for bool, etc). + /// + protected static object? SetPropertyToDefaultValue(T source, string propertyName) + where T : class + { + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(propertyName); + + PropertyInfo property = GetExistingProperty(typeof(T), propertyName); + + object? defaultValue = property.PropertyType.IsValueType ? Activator.CreateInstance(property.PropertyType) : null; + property.SetValue(source, defaultValue); + + return defaultValue; + } + + /// + /// Sets the property on the specified source to its initial value, when the type was constructed. This takes the presence of a type initializer into + /// account. + /// + protected static void SetPropertyToInitialValue(T source, string propertyName) + where T : class, new() + { + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(propertyName); + + var emptyRelationshipsObject = new T(); + object? defaultValue = emptyRelationshipsObject.GetPropertyValue(propertyName); + + source.SetPropertyValue(propertyName, defaultValue); + } + + /// + /// Sets the 'Data' property of the specified relationship to null. + /// + protected static void SetDataPropertyToNull(T source, string relationshipPropertyName) + where T : class + { + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(relationshipPropertyName); + + PropertyInfo relationshipProperty = GetExistingProperty(typeof(T), relationshipPropertyName); + object? relationshipValue = relationshipProperty.GetValue(source); + + if (relationshipValue == null) + { + throw new InvalidOperationException($"Property '{typeof(T).Name}.{relationshipPropertyName}' is null."); + } + + PropertyInfo dataProperty = GetExistingProperty(relationshipProperty.PropertyType, "Data"); + dataProperty.SetValue(relationshipValue, null); + } + + private static PropertyInfo GetExistingProperty(Type type, string propertyName) + { + PropertyInfo? property = type.GetProperty(propertyName); + + if (property == null) + { + throw new InvalidOperationException($"Type '{type.Name}' does not contain a property named '{propertyName}'."); + } + + return property; + } +} diff --git a/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs b/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs new file mode 100644 index 0000000000..d14d2ae4c6 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ChangeTracking/SerializerChangeTrackingTests.cs @@ -0,0 +1,846 @@ +using System.Net; +using FluentAssertions; +using JetBrains.Annotations; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.NamingConventions.CamelCase.GeneratedCode; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ChangeTracking; + +public sealed class SerializerChangeTrackingTests +{ + [Fact] + public async Task Includes_properties_with_default_values_when_tracked() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0, + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + requestBody.Data.Attributes.RequiredNonNullableReferenceType = "other"; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "requiredNonNullableReferenceType": "other", + "nullableReferenceType": null, + "valueType": 0, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Excludes_properties_with_default_values_when_not_tracked() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient).Initializer + } + }; + + requestBody.Data.Attributes.RequiredNonNullableReferenceType = "other"; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "requiredNonNullableReferenceType": "other" + } + } + } + """); + } + + [Fact] + public async Task Properties_can_be_changed_to_default_values_once_tracked() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 1, + NullableValueType = 2, + NullableReferenceType = "other" + } + }.Initializer + } + }; + + requestBody.Data.Attributes.ValueType = 0; + requestBody.Data.Attributes.NullableValueType = null; + requestBody.Data.Attributes.NullableReferenceType = null; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "valueType": 0, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Automatically_clears_tracked_properties_after_sending_request() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0, + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + wrapper.ChangeResponse(HttpStatusCode.NoContent, null); + + requestBody.Data.Attributes.ValueType = 1; + requestBody.Data.Attributes.RequiredValueType = 2; + requestBody.Data.Attributes.RequiredNullableValueType = 3; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "valueType": 1, + "requiredValueType": 2, + "requiredNullableValueType": 3 + } + } + } + """); + } + + [Fact] + public async Task Can_preserve_tracked_properties_after_sending_request() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient) + { + AutoClearTracked = false + }; + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0, + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + wrapper.ChangeResponse(HttpStatusCode.NoContent, null); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "valueType": 0, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Can_manually_clear_tracked_properties() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient) + { + AutoClearTracked = false + }; + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0, + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + apiClient.ClearAllTracked(); + + requestBody.Data.Attributes.ValueType = 1; + requestBody.Data.Attributes.RequiredValueType = 2; + requestBody.Data.Attributes.RequiredNullableValueType = 3; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "valueType": 1, + "requiredValueType": 2, + "requiredNullableValueType": 3 + } + } + } + """); + } + + [Fact] + public async Task Can_mark_existing_instance_as_tracked() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new AttributesInUpdateResourceRequest() + } + }; + + apiClient.MarkAsTracked(requestBody.Data.Attributes); + requestBody.Data.Attributes.RequiredNonNullableReferenceType = "other"; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "requiredNonNullableReferenceType": "other" + } + } + } + """); + } + + [Fact] + public async Task Can_mark_properties_on_existing_instance_as_tracked() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new AttributesInUpdateResourceRequest() + } + }; + + string[] propertyNamesToTrack = + [ + nameof(AttributesInUpdateResourceRequest.ValueType), + nameof(AttributesInUpdateResourceRequest.NullableValueType), + nameof(AttributesInUpdateResourceRequest.NullableReferenceType) + ]; + + apiClient.MarkAsTracked(requestBody.Data.Attributes, propertyNamesToTrack); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "valueType": 0, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public void Can_recursively_track_properties_on_complex_object() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new ExposeSerializerSettingsOnApiClient(wrapper.HttpClient); + + ComplexType complexObject = new TrackChangesFor(apiClient) + { + Initializer = + { + NullableDateTime = null, + NestedType = new TrackChangesFor(apiClient) + { + Initializer = + { + NullableInt = null, + NullableString = null + } + }.Initializer + } + }.Initializer; + + JsonSerializerSettings serializerSettings = apiClient.GetSerializerSettings(); + + // Act + string json = JsonConvert.SerializeObject(complexObject, serializerSettings); + + // Assert + json.Should().BeJson(""" + { + "NullableDateTime": null, + "NestedType": { + "NullableInt": null, + "NullableString": null + } + } + """); + } + + [Fact] + public async Task Tracking_a_different_instance_of_same_type_upfront_is_isolated() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + _ = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0 + } + }.Initializer + } + }; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Tracking_a_different_instance_of_same_type_afterward_is_isolated() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + _ = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0 + } + }.Initializer + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Can_reuse_api_client() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody1 = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0 + } + }.Initializer + } + }; + + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody1)); + wrapper.ChangeResponse(HttpStatusCode.NoContent, null); + + var requestBody2 = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + NullableValueType = null, + NullableReferenceType = null + } + }.Initializer + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody2)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "nullableReferenceType": null, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Can_reuse_request_document_on_same_api_client() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + string resourceId = Unknown.StringId.Int32; + + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = resourceId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + ValueType = 0, + RequiredNonNullableReferenceType = "first" + } + }.Initializer + } + }; + + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + wrapper.ChangeResponse(HttpStatusCode.NoContent, null); + + requestBody.Data.Attributes.NullableValueType = null; + requestBody.Data.Attributes.NullableReferenceType = null; + requestBody.Data.Attributes.RequiredNonNullableReferenceType = "other"; + + string[] propertyNamesToTrack = + [ + nameof(AttributesInUpdateResourceRequest.NullableValueType), + nameof(AttributesInUpdateResourceRequest.NullableReferenceType) + ]; + + apiClient.MarkAsTracked(requestBody.Data.Attributes, propertyNamesToTrack); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(resourceId, null, requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "resources", + "id": "{{resourceId}}", + "attributes": { + "openapi:discriminator": "resources", + "requiredNonNullableReferenceType": "other", + "nullableReferenceType": null, + "nullableValueType": null + } + } + } + """); + } + + [Fact] + public async Task Can_track_multiple_times_in_same_request_document() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new CamelCaseClient(wrapper.HttpClient); + + var requestBody = new OperationsRequestDocument + { + Atomic_operations = + [ + new UpdateStaffMemberOperation + { + Data = new DataInUpdateStaffMemberRequest + { + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + Age = null + } + }.Initializer + } + }, + new UpdateStaffMemberOperation + { + Data = new DataInUpdateStaffMemberRequest + { + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + Name = "new-name" + } + }.Initializer + } + }, + new UpdateSupermarketOperation + { + Data = new DataInUpdateSupermarketRequest + { + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + NameOfCity = "new-name-of-city" + } + }.Initializer + } + }, + new UpdateSupermarketOperation + { + Data = new DataInUpdateSupermarketRequest + { + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + Kind = null + } + }.Initializer + } + } + ] + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + wrapper.RequestBody.Should().BeJson(""" + { + "atomic:operations": [ + { + "openapi:discriminator": "updateStaffMember", + "op": "update", + "data": { + "type": "staffMembers", + "attributes": { + "openapi:discriminator": "staffMembers", + "age": null + } + } + }, + { + "openapi:discriminator": "updateStaffMember", + "op": "update", + "data": { + "type": "staffMembers", + "attributes": { + "openapi:discriminator": "staffMembers", + "name": "new-name" + } + } + }, + { + "openapi:discriminator": "updateSupermarket", + "op": "update", + "data": { + "type": "supermarkets", + "attributes": { + "openapi:discriminator": "supermarkets", + "nameOfCity": "new-name-of-city" + } + } + }, + { + "openapi:discriminator": "updateSupermarket", + "op": "update", + "data": { + "type": "supermarkets", + "attributes": { + "openapi:discriminator": "supermarkets", + "kind": null + } + } + } + ] + } + """); + } + + [UsedImplicitly(ImplicitUseTargetFlags.Members)] + private sealed class ComplexType : NotifyPropertySet + { + private DateTime? _nullableDateTime; + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] + public DateTime? NullableDateTime + { + get => _nullableDateTime; + set => SetProperty(ref _nullableDateTime, value); + } + + public NestedType? NestedType { get; set; } + } + + [UsedImplicitly(ImplicitUseTargetFlags.Members)] + private sealed class NestedType : NotifyPropertySet + { + private int? _nullableInt; + private string? _nullableString; + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] + public int? NullableInt + { + get => _nullableInt; + set => SetProperty(ref _nullableInt, value); + } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)] + public string? NullableString + { + get => _nullableString; + set => SetProperty(ref _nullableString, value); + } + } + + private sealed class ExposeSerializerSettingsOnApiClient(HttpClient httpClient) + : NrtOnMsvOnClient(httpClient) + { + public JsonSerializerSettings GetSerializerSettings() + { + return JsonSerializerSettings; + } + } +} diff --git a/test/OpenApiNSwagClientTests/FakeHttpClientWrapper.cs b/test/OpenApiNSwagClientTests/FakeHttpClientWrapper.cs new file mode 100644 index 0000000000..353933e630 --- /dev/null +++ b/test/OpenApiNSwagClientTests/FakeHttpClientWrapper.cs @@ -0,0 +1,120 @@ +using System.Net; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiNSwagClientTests; + +/// +/// Enables to inject an outgoing response body and inspect the incoming request. +/// +internal sealed class FakeHttpClientWrapper : IDisposable +{ + private readonly FakeHttpMessageHandler _handler; + + public HttpClient HttpClient { get; } + public HttpRequestMessage? Request => _handler.Request; + public string? RequestBody => _handler.RequestBody; + + private FakeHttpClientWrapper(HttpClient httpClient, FakeHttpMessageHandler handler) + { + HttpClient = httpClient; + _handler = handler; + } + + public JsonElement GetRequestBodyAsJson() + { + if (RequestBody == null) + { + throw new InvalidOperationException("No body was provided with the request."); + } + + using JsonDocument jsonDocument = JsonDocument.Parse(RequestBody); + return jsonDocument.RootElement.Clone(); + } + + public static FakeHttpClientWrapper Create(HttpStatusCode statusCode, string? responseBody) + { +#pragma warning disable CA2000 // Dispose objects before losing scope + // Justification: FakeHttpMessageHandler takes ownership, which is owned by FakeHttpClientWrapper. + HttpResponseMessage response = CreateResponse(statusCode, responseBody); +#pragma warning restore CA2000 // Dispose objects before losing scope + var handler = new FakeHttpMessageHandler(response); + + var httpClient = new HttpClient(handler) + { + BaseAddress = new Uri("http://localhost") + }; + + return new FakeHttpClientWrapper(httpClient, handler); + } + + public void ChangeResponse(HttpStatusCode statusCode, string? responseBody) + { + HttpResponseMessage response = CreateResponse(statusCode, responseBody); + + _handler.SetResponse(response); + } + + private static HttpResponseMessage CreateResponse(HttpStatusCode statusCode, string? responseBody) + { + var response = new HttpResponseMessage(statusCode); + + if (!string.IsNullOrEmpty(responseBody)) + { + response.Content = new StringContent(responseBody, Encoding.UTF8); + response.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(JsonApiMediaType.Default.ToString()); + } + + return response; + } + + public void Dispose() + { + HttpClient.Dispose(); + _handler.Dispose(); + } + + private sealed class FakeHttpMessageHandler(HttpResponseMessage response) : HttpMessageHandler + { + private HttpResponseMessage _response = response; + + public HttpRequestMessage? Request { get; private set; } + public string? RequestBody { get; private set; } + + public void SetResponse(HttpResponseMessage response) + { + ArgumentNullException.ThrowIfNull(response); + + _response = response; + } + + protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) + { + Request = request; + + // Capture the request body here, before it becomes inaccessible because the request has been disposed. + if (request.Content != null) + { + using Stream stream = request.Content.ReadAsStream(cancellationToken); + using var reader = new StreamReader(stream, Encoding.UTF8); + RequestBody = reader.ReadToEnd(); + } + + return _response; + } + + protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + HttpResponseMessage response = Send(request, cancellationToken); + return Task.FromResult(response); + } + + protected override void Dispose(bool disposing) + { + _response.Dispose(); + base.Dispose(disposing); + } + } +} diff --git a/test/OpenApiNSwagClientTests/FakerFactory.cs b/test/OpenApiNSwagClientTests/FakerFactory.cs new file mode 100644 index 0000000000..024dd92287 --- /dev/null +++ b/test/OpenApiNSwagClientTests/FakerFactory.cs @@ -0,0 +1,73 @@ +using System.Reflection; +using AutoBogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +namespace OpenApiNSwagClientTests; + +internal sealed class FakerFactory +{ + public static FakerFactory Instance { get; } = new(); + + private FakerFactory() + { + } + + public AutoFaker Create() + where TTarget : class + { + return GetDeterministicFaker(); + } + + private static AutoFaker GetDeterministicFaker() + where TTarget : class + { + var autoFaker = new AutoFaker(); + autoFaker.UseDateTimeReference(IntegrationTest.DefaultDateTimeUtc.UtcDateTime); + autoFaker.UseSeed(FakerExtensions.GetFakerSeed()); + return autoFaker; + } + + public AutoFaker CreateForObjectWithResourceId() + where TTarget : class + { + return GetDeterministicFaker().Configure(builder => builder.WithOverride(new ResourceStringIdOverride())); + } + + private sealed class ResourceStringIdOverride : AutoGeneratorOverride + { + // AutoFaker has a class constraint, while TId has not, so we need to wrap it. + private readonly AutoFaker> _idContainerFaker = GetDeterministicFaker>(); + + public override bool CanOverride(AutoGenerateContext context) + { + PropertyInfo? resourceIdPropertyInfo = context.GenerateType.GetProperty("Id"); + return resourceIdPropertyInfo != null && resourceIdPropertyInfo.PropertyType == typeof(string); + } + + public override void Generate(AutoGenerateOverrideContext context) + { + object idValue = _idContainerFaker.GenerateOne().Value!; + idValue = ToPositiveValue(idValue); + + ((dynamic)context.Instance).Id = idValue.ToString()!; + } + + private static object ToPositiveValue(object idValue) + { + return idValue switch + { + short shortValue => Math.Abs(shortValue), + int intValue => Math.Abs(intValue), + long longValue => Math.Abs(longValue), + _ => idValue + }; + } + + [UsedImplicitly(ImplicitUseTargetFlags.Members)] + private sealed class ObjectContainer + { + public TValue? Value { get; set; } + } + } +} diff --git a/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs b/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs new file mode 100644 index 0000000000..4d153ca80d --- /dev/null +++ b/test/OpenApiNSwagClientTests/LegacyOpenApi/RequestTests.cs @@ -0,0 +1,532 @@ +using System.Net; +using FluentAssertions; +using FluentAssertions.Common; +using FluentAssertions.Extensions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.Net.Http.Headers; +using OpenApiNSwagClientTests.LegacyOpenApi.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.LegacyOpenApi; + +public sealed class RequestTests +{ + private const string OpenApiMediaType = "application/vnd.api+json; ext=openapi"; + private const string HostPrefix = "http://localhost/api/"; + + [Fact] + public async Task Getting_resource_collection_produces_expected_request() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightCollectionAsync(null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Getting_resource_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightAsync(flightId, null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Partial_posting_resource_with_selected_relationships_produces_expected_request() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new CreateFlightRequestDocument + { + Data = new DataInCreateFlightRequest + { + Relationships = new RelationshipsInCreateFlightRequest + { + Purser = new ToOneFlightAttendantInRequest + { + Data = new FlightAttendantIdentifierInRequest + { + Id = "bBJHu" + } + }, + BackupPurser = new NullableToOneFlightAttendantInRequest + { + Data = new FlightAttendantIdentifierInRequest + { + Id = "NInmX" + } + } + } + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PostFlightAsync(null, requestBody)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Post); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": { + "type": "flights", + "relationships": { + "openapi:discriminator": "flights", + "purser": { + "data": { + "type": "flight-attendants", + "id": "bBJHu" + } + }, + "backup-purser": { + "data": { + "type": "flight-attendants", + "id": "NInmX" + } + } + } + } + } + """); + } + + [Fact] + public async Task Partial_posting_resource_produces_expected_request() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + const char euroSign = '\x20AC'; + const char checkMark = '\x2713'; + const char capitalLWithStroke = '\x0141'; + + string specialCharacters = new(new[] + { + euroSign, + checkMark, + capitalLWithStroke + }); + + string name = $"anAirplaneName {specialCharacters}"; + + var requestBody = new CreateAirplaneRequestDocument + { + Data = new DataInCreateAirplaneRequest + { + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + Name = name, + AirtimeInHours = 800, + SerialNumber = null + } + }.Initializer + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PostAirplaneAsync(null, requestBody)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Post); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}airplanes"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson($$""" + { + "data": { + "type": "airplanes", + "attributes": { + "openapi:discriminator": "airplanes", + "name": "{{name}}", + "serial-number": null, + "airtime-in-hours": 800 + } + } + } + """); + } + + [Fact] + public async Task Partial_patching_resource_produces_expected_request() + { + // Arrange + const string airplaneId = "XUuiP"; + var lastServicedAt = 1.January(2021).At(15, 23, 5, 33).ToDateTimeOffset(4.Hours()); + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new UpdateAirplaneRequestDocument + { + Data = new DataInUpdateAirplaneRequest + { + Id = airplaneId, + Attributes = new TrackChangesFor(apiClient) + { + Initializer = + { + LastServicedAt = lastServicedAt, + SerialNumber = null, + IsInMaintenance = false, + AirtimeInHours = null + } + }.Initializer + } + }; + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.PatchAirplaneAsync(airplaneId, null, requestBody)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Patch); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}airplanes/{airplaneId}"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": { + "type": "airplanes", + "id": "XUuiP", + "attributes": { + "openapi:discriminator": "airplanes", + "serial-number": null, + "airtime-in-hours": null, + "last-serviced-at": "2021-01-01T15:23:05.033+04:00", + "is-in-maintenance": false + } + } + } + """); + } + + [Fact] + public async Task Deleting_resource_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + await apiClient.DeleteFlightAsync(flightId); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Method.Should().Be(HttpMethod.Delete); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Getting_secondary_resource_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightPurserAsync(flightId, null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/purser"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Getting_secondary_resources_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightCabinCrewMembersAsync(flightId, null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/cabin-crew-members"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Getting_ToOne_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightPurserRelationshipAsync(flightId, null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/purser"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Patching_ToOne_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToOneFlightAttendantInRequest + { + Data = new FlightAttendantIdentifierInRequest + { + Id = "bBJHu" + } + }; + + // Act + await apiClient.PatchFlightPurserRelationshipAsync(flightId, requestBody); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Method.Should().Be(HttpMethod.Patch); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/purser"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": { + "type": "flight-attendants", + "id": "bBJHu" + } + } + """); + } + + [Fact] + public async Task Getting_ToMany_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + _ = await ApiResponse.TranslateAsync(async () => await apiClient.GetFlightCabinCrewMembersRelationshipAsync(flightId, null, null)); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Headers.GetValue(HeaderNames.Accept).Should().Be(OpenApiMediaType); + wrapper.Request.Method.Should().Be(HttpMethod.Get); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); + wrapper.RequestBody.Should().BeNull(); + } + + [Fact] + public async Task Posting_ToMany_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "bBJHu" + }, + new FlightAttendantIdentifierInRequest + { + Id = "NInmX" + } + ] + }; + + // Act + await apiClient.PostFlightCabinCrewMembersRelationshipAsync(flightId, requestBody); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Method.Should().Be(HttpMethod.Post); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": [ + { + "type": "flight-attendants", + "id": "bBJHu" + }, + { + "type": "flight-attendants", + "id": "NInmX" + } + ] + } + """); + } + + [Fact] + public async Task Patching_ToMany_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "bBJHu" + }, + new FlightAttendantIdentifierInRequest + { + Id = "NInmX" + } + ] + }; + + // Act + await apiClient.PatchFlightCabinCrewMembersRelationshipAsync(flightId, requestBody); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Method.Should().Be(HttpMethod.Patch); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": [ + { + "type": "flight-attendants", + "id": "bBJHu" + }, + { + "type": "flight-attendants", + "id": "NInmX" + } + ] + } + """); + } + + [Fact] + public async Task Deleting_ToMany_relationship_produces_expected_request() + { + // Arrange + const string flightId = "ZvuH1"; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "bBJHu" + }, + new FlightAttendantIdentifierInRequest + { + Id = "NInmX" + } + ] + }; + + // Act + await apiClient.DeleteFlightCabinCrewMembersRelationshipAsync(flightId, requestBody); + + // Assert + wrapper.Request.Should().NotBeNull(); + wrapper.Request.Method.Should().Be(HttpMethod.Delete); + wrapper.Request.RequestUri.Should().Be($"{HostPrefix}flights/{flightId}/relationships/cabin-crew-members"); + wrapper.Request.Content.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType.Should().NotBeNull(); + wrapper.Request.Content!.Headers.ContentType!.ToString().Should().Be(OpenApiMediaType); + + wrapper.RequestBody.Should().BeJson(""" + { + "data": [ + { + "type": "flight-attendants", + "id": "bBJHu" + }, + { + "type": "flight-attendants", + "id": "NInmX" + } + ] + } + """); + } +} diff --git a/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs b/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs new file mode 100644 index 0000000000..0da98c30af --- /dev/null +++ b/test/OpenApiNSwagClientTests/LegacyOpenApi/ResponseTests.cs @@ -0,0 +1,722 @@ +using System.Globalization; +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagClientTests.LegacyOpenApi.GeneratedCode; +using Xunit; + +namespace OpenApiNSwagClientTests.LegacyOpenApi; + +public sealed class ResponseTests +{ + private const string HostPrefix = "http://localhost/api/"; + + [Fact] + public async Task Getting_resource_collection_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string flightDestination = "Amsterdam"; + const string flightServiceOnBoard = "Movies"; + const string flightDepartsAt = "2014-11-25T00:00:00"; + const string documentMetaValue = "1"; + const string flightMetaValue = "https://api.jsonapi.net/docs/#get-flights"; + const string purserMetaValue = "https://api.jsonapi.net/docs/#get-flight-purser"; + const string cabinCrewMembersMetaValue = "https://api.jsonapi.net/docs/#get-flight-cabin-crew-members"; + const string passengersMetaValue = "https://api.jsonapi.net/docs/#get-flight-passengers"; + const string topLevelLink = $"{HostPrefix}flights"; + const string flightResourceLink = $"{topLevelLink}/{flightId}"; + + const string responseBody = $$""" + { + "meta": { + "total-resources": "{{documentMetaValue}}" + }, + "links": { + "self": "{{topLevelLink}}", + "first": "{{topLevelLink}}", + "last": "{{topLevelLink}}" + }, + "data": [ + { + "type": "flights", + "id": "{{flightId}}", + "attributes": { + "final-destination": "{{flightDestination}}", + "stop-over-destination": null, + "operated-by": "DeltaAirLines", + "departs-at": "{{flightDepartsAt}}", + "arrives-at": null, + "services-on-board": [ + "{{flightServiceOnBoard}}", + "", + null + ] + }, + "relationships": { + "purser": { + "links": { + "self": "{{flightResourceLink}}/relationships/purser", + "related": "{{flightResourceLink}}/purser" + }, + "meta": { + "docs": "{{purserMetaValue}}" + } + }, + "cabin-crew-members": { + "links": { + "self": "{{flightResourceLink}}/relationships/cabin-crew-members", + "related": "{{flightResourceLink}}/cabin-crew-members" + }, + "meta": { + "docs": "{{cabinCrewMembersMetaValue}}" + } + }, + "passengers": { + "links": { + "self": "{{flightResourceLink}}/relationships/passengers", + "related": "{{flightResourceLink}}/passengers" + }, + "meta": { + "docs": "{{passengersMetaValue}}" + } + } + }, + "links": { + "self": "{{flightResourceLink}}" + }, + "meta": { + "docs": "{{flightMetaValue}}" + } + } + ] + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + FlightCollectionResponseDocument response = await apiClient.GetFlightCollectionAsync(null, null); + + // Assert + response.Jsonapi.Should().BeNull(); + response.Meta.Should().HaveCount(1); + response.Meta["total-resources"].Should().Be(documentMetaValue); + response.Links.Self.Should().Be(topLevelLink); + response.Links.First.Should().Be(topLevelLink); + response.Links.Last.Should().Be(topLevelLink); + response.Data.Should().HaveCount(1); + + DataInFlightResponse flight = response.Data.First(); + flight.Id.Should().Be(flightId); + flight.Links.Self.Should().Be(flightResourceLink); + flight.Meta.Should().HaveCount(1); + flight.Meta["docs"].Should().Be(flightMetaValue); + + flight.Attributes.FinalDestination.Should().Be(flightDestination); + flight.Attributes.StopOverDestination.Should().BeNull(); + flight.Attributes.ServicesOnBoard.Should().HaveCount(3); + flight.Attributes.ServicesOnBoard.ElementAt(0).Should().Be(flightServiceOnBoard); + flight.Attributes.ServicesOnBoard.ElementAt(1).Should().Be(string.Empty); + flight.Attributes.ServicesOnBoard.ElementAt(2).Should().BeNull(); + flight.Attributes.OperatedBy.Should().Be(Airline.DeltaAirLines); + flight.Attributes.DepartsAt.Should().Be(DateTimeOffset.Parse(flightDepartsAt, new CultureInfo("en-GB"))); + flight.Attributes.ArrivesAt.Should().BeNull(); + + flight.Relationships.Purser.Data.Should().BeNull(); + flight.Relationships.Purser.Links.Self.Should().Be($"{flightResourceLink}/relationships/purser"); + flight.Relationships.Purser.Links.Related.Should().Be($"{flightResourceLink}/purser"); + flight.Relationships.Purser.Meta.Should().HaveCount(1); + flight.Relationships.Purser.Meta["docs"].Should().Be(purserMetaValue); + + flight.Relationships.CabinCrewMembers.Data.Should().BeNull(); + flight.Relationships.CabinCrewMembers.Links.Self.Should().Be($"{flightResourceLink}/relationships/cabin-crew-members"); + flight.Relationships.CabinCrewMembers.Links.Related.Should().Be($"{flightResourceLink}/cabin-crew-members"); + flight.Relationships.CabinCrewMembers.Meta.Should().HaveCount(1); + flight.Relationships.CabinCrewMembers.Meta["docs"].Should().Be(cabinCrewMembersMetaValue); + + flight.Relationships.Passengers.Data.Should().BeNull(); + flight.Relationships.Passengers.Links.Self.Should().Be($"{flightResourceLink}/relationships/passengers"); + flight.Relationships.Passengers.Links.Related.Should().Be($"{flightResourceLink}/passengers"); + flight.Relationships.Passengers.Meta.Should().HaveCount(1); + flight.Relationships.Passengers.Meta["docs"].Should().Be(passengersMetaValue); + } + + [Fact] + public async Task Getting_resource_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string departsAtInZuluTime = "2021-06-08T12:53:30.554Z"; + const string flightDestination = "Amsterdam"; + const string arrivesAtWithUtcOffset = "2019-02-20T11:56:33.0721266+01:00"; + const string flightServiceOnBoard = "Movies"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}&fields[flights]=departs-at,arrives-at" + }, + "data": { + "type": "flights", + "id": "{{flightId}}", + "attributes": { + "departs-at": "{{departsAtInZuluTime}}", + "arrives-at": "{{arrivesAtWithUtcOffset}}", + "final-destination": "{{flightDestination}}", + "services-on-board": ["{{flightServiceOnBoard}}"] + }, + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}" + } + } + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + PrimaryFlightResponseDocument response = await apiClient.GetFlightAsync(flightId, null, null); + + // Assert + response.Jsonapi.Should().BeNull(); + response.Meta.Should().BeNull(); + response.Data.Meta.Should().BeNull(); + response.Data.Relationships.Should().BeNull(); + response.Data.Attributes.DepartsAt.Should().Be(DateTimeOffset.Parse(departsAtInZuluTime)); + response.Data.Attributes.ArrivesAt.Should().Be(DateTimeOffset.Parse(arrivesAtWithUtcOffset)); + response.Data.Attributes.ServicesOnBoard.Should().Contain(flightServiceOnBoard); + response.Data.Attributes.FinalDestination.Should().Be(flightDestination); + response.Data.Attributes.StopOverDestination.Should().BeNull(); + response.Data.Attributes.OperatedBy.Should().Be(default); + } + + [Fact] + public async Task Getting_unknown_resource_translates_error_response() + { + // Arrange + const string flightId = "ZvuH1"; + + const string responseBody = $$""" + { + "links": { + "self": "http://localhost/api/flights/ZvuH1", + "describedby": "/swagger/v1/swagger.json" + }, + "errors": [ + { + "id": "f1a520ac-02a0-466b-94ea-86cbaa86f02f", + "status": "404", + "title": "The requested resource does not exist.", + "detail": "Resource of type 'flights' with ID '{{flightId}}' does not exist." + } + ] + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NotFound, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.GetFlightAsync(flightId, null, null); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Result.Links.Should().NotBeNull(); + exception.Result.Links.Self.Should().Be("http://localhost/api/flights/ZvuH1"); + exception.Result.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Id.Should().Be("f1a520ac-02a0-466b-94ea-86cbaa86f02f"); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'flights' with ID '{flightId}' does not exist."); + error.Source.Should().BeNull(); + } + + [Fact] + public async Task Posting_resource_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string flightAttendantId = "bBJHu"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}&fields[flights]&include=purser,cabin-crew-members,passengers" + }, + "data": { + "type": "flights", + "id": "{{flightId}}", + "relationships": { + "purser": { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/purser", + "related": "{{HostPrefix}}flights/{{flightId}}/purser" + }, + "data": { + "type": "flight-attendants", + "id": "{{flightAttendantId}}" + } + }, + "cabin-crew-members": { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/cabin-crew-members", + "related": "{{HostPrefix}}flights/{{flightId}}/cabin-crew-members" + }, + "data": [ + { + "type": "flight-attendants", + "id": "{{flightAttendantId}}" + } + ], + }, + "passengers": { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/passengers", + "related": "{{HostPrefix}}flights/{{flightId}}/passengers" + }, + "data": [ ] + } + }, + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}&fields[flights]&include=purser,cabin-crew-members,passengers" + } + } + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.Created, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new CreateFlightRequestDocument + { + Data = new DataInCreateFlightRequest + { + Relationships = new RelationshipsInCreateFlightRequest + { + Purser = new ToOneFlightAttendantInRequest + { + Data = new FlightAttendantIdentifierInRequest + { + Id = flightAttendantId + } + } + } + } + }; + + // Act + PrimaryFlightResponseDocument response = await apiClient.PostFlightAsync(null, requestBody); + + // Assert + response.Data.Attributes.Should().BeNull(); + response.Data.Relationships.Purser.Data.Should().NotBeNull(); + response.Data.Relationships.Purser.Data.Id.Should().Be(flightAttendantId); + response.Data.Relationships.CabinCrewMembers.Data.Should().HaveCount(1); + response.Data.Relationships.CabinCrewMembers.Data.First().Id.Should().Be(flightAttendantId); + response.Data.Relationships.CabinCrewMembers.Data.First().Type.Should().Be(FlightAttendantResourceType.FlightAttendants); + response.Data.Relationships.Passengers.Data.Should().BeEmpty(); + } + + [Fact] + public async Task Patching_resource_with_side_effects_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}&fields[flights]" + }, + "data": { + "type": "flights", + "id": "{{flightId}}", + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}&fields[flights]&include=purser,cabin-crew-members,passengers" + } + } + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new UpdateFlightRequestDocument + { + Data = new DataInUpdateFlightRequest + { + Id = flightId + } + }; + + // Act + PrimaryFlightResponseDocument response = await apiClient.PatchFlightAsync(flightId, null, requestBody); + + // Assert + response.Data.Attributes.Should().BeNull(); + response.Data.Relationships.Should().BeNull(); + } + + [Fact] + public async Task Patching_resource_without_side_effects_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + PrimaryFlightResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PatchFlightAsync(flightId, null, + new UpdateFlightRequestDocument + { + Data = new DataInUpdateFlightRequest + { + Id = flightId + } + })); + + // Assert + response.Should().BeNull(); + } + + [Fact] + public async Task Deleting_resource_produces_empty_response() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.DeleteFlightAsync("ZvuH1"); + + // Assert + await action.Should().NotThrowAsync(); + } + + [Fact] + public async Task Getting_secondary_resource_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string purserId = "bBJHu"; + const string emailAddress = "email@example.com"; + const string age = "20"; + const string profileImageUrl = "www.image.com"; + const string distanceTraveledInKilometer = "5000"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/purser", + "first": "{{HostPrefix}}flights/{{flightId}}/purser", + "last": "{{HostPrefix}}flights/{{flightId}}/purser" + }, + "data": { + "type": "flight-attendants", + "id": "{{purserId}}", + "attributes": { + "email-address": "{{emailAddress}}", + "age": "{{age}}", + "profile-image-url": "{{profileImageUrl}}", + "distance-traveled-in-kilometers": "{{distanceTraveledInKilometer}}", + }, + "relationships": { + "scheduled-for-flights": { + "links": { + "self": "{{HostPrefix}}flight-attendants/{{purserId}}/relationships/scheduled-for-flights", + "related": "{{HostPrefix}}flight-attendants/{{purserId}}/scheduled-for-flights" + } + }, + "purser-on-flights": { + "links": { + "self": "{{HostPrefix}}flight-attendants/{{purserId}}/relationships/purser-on-flights", + "related": "{{HostPrefix}}flight-attendants/{{purserId}}/purser-on-flights" + } + }, + }, + "links": { + "self": "{{HostPrefix}}flight-attendants/{{purserId}}", + } + } + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + SecondaryFlightAttendantResponseDocument response = await apiClient.GetFlightPurserAsync(flightId, null, null); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(purserId); + response.Data.Attributes.EmailAddress.Should().Be(emailAddress); + response.Data.Attributes.Age.Should().Be(int.Parse(age)); + response.Data.Attributes.ProfileImageUrl.Should().Be(profileImageUrl); + response.Data.Attributes.DistanceTraveledInKilometers.Should().Be(int.Parse(distanceTraveledInKilometer)); + } + + [Fact] + public async Task Getting_nullable_secondary_resource_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/backup-purser", + "first": "{{HostPrefix}}flights/{{flightId}}/backup-purser", + "last": "{{HostPrefix}}flights/{{flightId}}/backup-purser" + }, + "data": null + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + NullableSecondaryFlightAttendantResponseDocument response = await apiClient.GetFlightBackupPurserAsync(flightId, null, null); + + // Assert + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Getting_secondary_resources_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/cabin-crew-members", + "first": "{{HostPrefix}}flights/{{flightId}}/cabin-crew-members" + }, + "data": [ ] + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + FlightAttendantCollectionResponseDocument response = await apiClient.GetFlightCabinCrewMembersAsync(flightId, null, null); + + // Assert + response.Data.Should().BeEmpty(); + } + + [Fact] + public async Task Getting_nullable_ToOne_relationship_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/backup-purser", + "related": "{{HostPrefix}}flights/{{flightId}}/relationships/backup-purser" + }, + "data": null + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + NullableFlightAttendantIdentifierResponseDocument response = await apiClient.GetFlightBackupPurserRelationshipAsync(flightId, null, null); + + // Assert + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Getting_ToOne_relationship_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string purserId = "bBJHu"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/purser", + "related": "{{HostPrefix}}flights/{{flightId}}/relationships/purser" + }, + "data": { + "type": "flight-attendants", + "id": "{{purserId}}" + } + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + FlightAttendantIdentifierResponseDocument response = await apiClient.GetFlightPurserRelationshipAsync(flightId, null, null); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(purserId); + response.Data.Type.Should().Be(FlightAttendantResourceType.FlightAttendants); + } + + [Fact] + public async Task Patching_ToOne_relationship_translates_response() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToOneFlightAttendantInRequest + { + Data = new FlightAttendantIdentifierInRequest + { + Id = "Adk2a" + } + }; + + // Act + await apiClient.PatchFlightPurserRelationshipAsync("ZvuH1", requestBody); + } + + [Fact] + public async Task Getting_ToMany_relationship_translates_response() + { + // Arrange + const string flightId = "ZvuH1"; + const string flightAttendantId1 = "bBJHu"; + const string flightAttendantId2 = "ZvuHNInmX1"; + + const string responseBody = $$""" + { + "links": { + "self": "{{HostPrefix}}flights/{{flightId}}/relationships/cabin-crew-members", + "related": "{{HostPrefix}}flights/{{flightId}}/relationships/cabin-crew-members", + "first": "{{HostPrefix}}flights/{{flightId}}/relationships/cabin-crew-members" + }, + "data": [{ + "type": "flight-attendants", + "id": "{{flightAttendantId1}}" + }, + { + "type": "flight-attendants", + "id": "{{flightAttendantId2}}" + }] + } + """; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.OK, responseBody); + var apiClient = new LegacyClient(wrapper.HttpClient); + + // Act + FlightAttendantIdentifierCollectionResponseDocument response = await apiClient.GetFlightCabinCrewMembersRelationshipAsync(flightId, null, null); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.First().Id.Should().Be(flightAttendantId1); + response.Data.First().Type.Should().Be(FlightAttendantResourceType.FlightAttendants); + response.Data.Last().Id.Should().Be(flightAttendantId2); + response.Data.Last().Type.Should().Be(FlightAttendantResourceType.FlightAttendants); + } + + [Fact] + public async Task Posting_ToMany_relationship_produces_empty_response() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "Adk2a" + }, + new FlightAttendantIdentifierInRequest + { + Id = "Un37k" + } + ] + }; + + // Act + Func action = async () => await apiClient.PostFlightCabinCrewMembersRelationshipAsync("ZvuH1", requestBody); + + // Assert + await action.Should().NotThrowAsync(); + } + + [Fact] + public async Task Patching_ToMany_relationship_produces_empty_response() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "Adk2a" + }, + new FlightAttendantIdentifierInRequest + { + Id = "Un37k" + } + ] + }; + + // Act + Func action = async () => await apiClient.PatchFlightCabinCrewMembersRelationshipAsync("ZvuH1", requestBody); + + // Assert + await action.Should().NotThrowAsync(); + } + + [Fact] + public async Task Deleting_ToMany_relationship_produces_empty_response() + { + // Arrange + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new LegacyClient(wrapper.HttpClient); + + var requestBody = new ToManyFlightAttendantInRequest + { + Data = + [ + new FlightAttendantIdentifierInRequest + { + Id = "Adk2a" + }, + new FlightAttendantIdentifierInRequest + { + Id = "Un37k" + } + ] + }; + + // Act + Func action = async () => await apiClient.DeleteFlightCabinCrewMembersRelationshipAsync("ZvuH1", requestBody); + + // Assert + await action.Should().NotThrowAsync(); + } +} diff --git a/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs new file mode 100644 index 0000000000..6828e96d32 --- /dev/null +++ b/test/OpenApiNSwagClientTests/NamingConventions/CamelCase/GeneratedTypesTests.cs @@ -0,0 +1,203 @@ +using OpenApiNSwagClientTests.NamingConventions.CamelCase.GeneratedCode; +using Xunit; +using GeneratedClient = OpenApiNSwagClientTests.NamingConventions.CamelCase.GeneratedCode.CamelCaseClient; + +namespace OpenApiNSwagClientTests.NamingConventions.CamelCase; + +public sealed class GeneratedTypesTests +{ + [Fact] + public void Generated_endpoint_methods_are_named_as_expected() + { + _ = nameof(GeneratedClient.GetSupermarketCollectionAsync); + _ = nameof(GeneratedClient.HeadSupermarketCollectionAsync); + _ = nameof(GeneratedClient.PostSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketAsync); + _ = nameof(GeneratedClient.HeadSupermarketAsync); + _ = nameof(GeneratedClient.PatchSupermarketAsync); + _ = nameof(GeneratedClient.DeleteSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PostSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.DeleteSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketStoreManagerRelationshipAsync); + + _ = nameof(GeneratedClient.GetStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.HeadStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.PostStaffMemberAsync); + _ = nameof(GeneratedClient.GetStaffMemberAsync); + _ = nameof(GeneratedClient.HeadStaffMemberAsync); + _ = nameof(GeneratedClient.PatchStaffMemberAsync); + _ = nameof(GeneratedClient.DeleteStaffMemberAsync); + + _ = nameof(GeneratedClient.PostOperationsAsync); + } + + [Fact] + public void Generated_top_level_document_types_are_named_as_expected() + { + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); + } + + [Fact] + public void Generated_link_types_are_named_as_expected() + { + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); + _ = nameof(ErrorLinks); + } + + [Fact] + public void Generated_operation_types_are_named_as_expected() + { + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); + } + + [Fact] + public void Generated_resource_field_types_are_named_as_expected() + { + _ = nameof(AttributesInCreateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInCreateSupermarketRequest.Kind); + _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInUpdateSupermarketRequest.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); + _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); + _ = nameof(SupermarketType); + + _ = nameof(AttributesInCreateStaffMemberRequest.Name); + _ = nameof(AttributesInCreateStaffMemberRequest.Age); + _ = nameof(AttributesInUpdateStaffMemberRequest.Name); + _ = nameof(AttributesInUpdateStaffMemberRequest.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); + } + + [Fact] + public void Generated_relationship_container_types_are_named_as_expected() + { + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); + + _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); + _ = nameof(SupermarketCashiersRelationshipIdentifier); + _ = nameof(SupermarketStoreManagerRelationshipIdentifier); + } + + [Fact] + public void Generated_relationship_name_enums_are_named_as_expected() + { + _ = nameof(SupermarketBackupStoreManagerRelationshipName.BackupStoreManager); + _ = nameof(SupermarketCashiersRelationshipName.Cashiers); + _ = nameof(SupermarketStoreManagerRelationshipName.StoreManager); + } + + [Fact] + public void Generated_resource_type_enums_are_named_as_expected() + { + _ = nameof(SupermarketResourceType.Supermarkets); + _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); + } + + [Fact] + public void Generated_operation_type_enums_are_named_as_expected() + { + _ = nameof(AddOperationCode.Add); + _ = nameof(UpdateOperationCode.Update); + _ = nameof(RemoveOperationCode.Remove); + } + + [Fact] + public void Generated_data_types_are_named_as_expected() + { + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); + + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(DataInSupermarketResponse.Meta); + + _ = nameof(SupermarketIdentifierInRequest.Meta); + + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); + + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); + } + + [Fact] + public void Generated_predefined_types_are_named_as_expected() + { + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); + _ = nameof(ErrorSource); + _ = nameof(Meta); + + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); + } +} diff --git a/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs new file mode 100644 index 0000000000..ad58e822bd --- /dev/null +++ b/test/OpenApiNSwagClientTests/NamingConventions/KebabCase/GeneratedTypesTests.cs @@ -0,0 +1,203 @@ +using OpenApiNSwagClientTests.NamingConventions.KebabCase.GeneratedCode; +using Xunit; +using GeneratedClient = OpenApiNSwagClientTests.NamingConventions.KebabCase.GeneratedCode.KebabCaseClient; + +namespace OpenApiNSwagClientTests.NamingConventions.KebabCase; + +public sealed class GeneratedTypesTests +{ + [Fact] + public void Generated_endpoint_methods_are_named_as_expected() + { + _ = nameof(GeneratedClient.GetSupermarketCollectionAsync); + _ = nameof(GeneratedClient.HeadSupermarketCollectionAsync); + _ = nameof(GeneratedClient.PostSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketAsync); + _ = nameof(GeneratedClient.HeadSupermarketAsync); + _ = nameof(GeneratedClient.PatchSupermarketAsync); + _ = nameof(GeneratedClient.DeleteSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PostSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.DeleteSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketStoreManagerRelationshipAsync); + + _ = nameof(GeneratedClient.GetStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.HeadStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.PostStaffMemberAsync); + _ = nameof(GeneratedClient.GetStaffMemberAsync); + _ = nameof(GeneratedClient.HeadStaffMemberAsync); + _ = nameof(GeneratedClient.PatchStaffMemberAsync); + _ = nameof(GeneratedClient.DeleteStaffMemberAsync); + + _ = nameof(GeneratedClient.PostOperationsAsync); + } + + [Fact] + public void Generated_top_level_document_types_are_named_as_expected() + { + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); + } + + [Fact] + public void Generated_link_types_are_named_as_expected() + { + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); + _ = nameof(ErrorLinks); + } + + [Fact] + public void Generated_operation_types_are_named_as_expected() + { + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); + } + + [Fact] + public void Generated_resource_field_types_are_named_as_expected() + { + _ = nameof(AttributesInCreateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInCreateSupermarketRequest.Kind); + _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInUpdateSupermarketRequest.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); + _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); + _ = nameof(SupermarketType); + + _ = nameof(AttributesInCreateStaffMemberRequest.Name); + _ = nameof(AttributesInCreateStaffMemberRequest.Age); + _ = nameof(AttributesInUpdateStaffMemberRequest.Name); + _ = nameof(AttributesInUpdateStaffMemberRequest.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); + } + + [Fact] + public void Generated_relationship_container_types_are_named_as_expected() + { + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); + + _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); + _ = nameof(SupermarketCashiersRelationshipIdentifier); + _ = nameof(SupermarketStoreManagerRelationshipIdentifier); + } + + [Fact] + public void Generated_relationship_name_enums_are_named_as_expected() + { + _ = nameof(SupermarketBackupStoreManagerRelationshipName.BackupStoreManager); + _ = nameof(SupermarketCashiersRelationshipName.Cashiers); + _ = nameof(SupermarketStoreManagerRelationshipName.StoreManager); + } + + [Fact] + public void Generated_resource_type_enums_are_named_as_expected() + { + _ = nameof(SupermarketResourceType.Supermarkets); + _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); + } + + [Fact] + public void Generated_operation_type_enums_are_named_as_expected() + { + _ = nameof(AddOperationCode.Add); + _ = nameof(UpdateOperationCode.Update); + _ = nameof(RemoveOperationCode.Remove); + } + + [Fact] + public void Generated_data_types_are_named_as_expected() + { + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); + + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(DataInSupermarketResponse.Meta); + + _ = nameof(SupermarketIdentifierInRequest.Meta); + + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); + + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); + } + + [Fact] + public void Generated_predefined_types_are_named_as_expected() + { + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); + _ = nameof(ErrorSource); + _ = nameof(Meta); + + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); + } +} diff --git a/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs new file mode 100644 index 0000000000..916cd8d053 --- /dev/null +++ b/test/OpenApiNSwagClientTests/NamingConventions/PascalCase/GeneratedTypesTests.cs @@ -0,0 +1,203 @@ +using OpenApiNSwagClientTests.NamingConventions.PascalCase.GeneratedCode; +using Xunit; +using GeneratedClient = OpenApiNSwagClientTests.NamingConventions.PascalCase.GeneratedCode.PascalCaseClient; + +namespace OpenApiNSwagClientTests.NamingConventions.PascalCase; + +public sealed class GeneratedTypesTests +{ + [Fact] + public void Generated_endpoint_methods_are_named_as_expected() + { + _ = nameof(GeneratedClient.GetSupermarketCollectionAsync); + _ = nameof(GeneratedClient.HeadSupermarketCollectionAsync); + _ = nameof(GeneratedClient.PostSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketAsync); + _ = nameof(GeneratedClient.HeadSupermarketAsync); + _ = nameof(GeneratedClient.PatchSupermarketAsync); + _ = nameof(GeneratedClient.DeleteSupermarketAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketBackupStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersAsync); + _ = nameof(GeneratedClient.GetSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PostSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.DeleteSupermarketCashiersRelationshipAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerAsync); + _ = nameof(GeneratedClient.GetSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.HeadSupermarketStoreManagerRelationshipAsync); + _ = nameof(GeneratedClient.PatchSupermarketStoreManagerRelationshipAsync); + + _ = nameof(GeneratedClient.GetStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.HeadStaffMemberCollectionAsync); + _ = nameof(GeneratedClient.PostStaffMemberAsync); + _ = nameof(GeneratedClient.GetStaffMemberAsync); + _ = nameof(GeneratedClient.HeadStaffMemberAsync); + _ = nameof(GeneratedClient.PatchStaffMemberAsync); + _ = nameof(GeneratedClient.DeleteStaffMemberAsync); + + _ = nameof(GeneratedClient.PostOperationsAsync); + } + + [Fact] + public void Generated_top_level_document_types_are_named_as_expected() + { + _ = nameof(SupermarketCollectionResponseDocument.Meta); + _ = nameof(CreateSupermarketRequestDocument.Meta); + _ = nameof(PrimarySupermarketResponseDocument.Meta); + _ = nameof(UpdateSupermarketRequestDocument.Meta); + + _ = nameof(StaffMemberCollectionResponseDocument.Meta); + _ = nameof(CreateStaffMemberRequestDocument.Meta); + _ = nameof(PrimaryStaffMemberResponseDocument.Meta); + _ = nameof(UpdateStaffMemberRequestDocument.Meta); + _ = nameof(StaffMemberIdentifierCollectionResponseDocument.Meta); + _ = nameof(StaffMemberIdentifierResponseDocument.Meta); + _ = nameof(SecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableSecondaryStaffMemberResponseDocument.Meta); + _ = nameof(NullableStaffMemberIdentifierResponseDocument.Meta); + + _ = nameof(ErrorResponseDocument.Meta); + + _ = nameof(OperationsRequestDocument.Meta); + _ = nameof(OperationsResponseDocument.Meta); + } + + [Fact] + public void Generated_link_types_are_named_as_expected() + { + _ = nameof(ResourceTopLevelLinks); + _ = nameof(ResourceCollectionTopLevelLinks); + _ = nameof(ResourceIdentifierTopLevelLinks); + _ = nameof(ResourceIdentifierCollectionTopLevelLinks); + _ = nameof(ErrorTopLevelLinks); + _ = nameof(ResourceLinks); + _ = nameof(RelationshipLinks); + _ = nameof(ErrorLinks); + } + + [Fact] + public void Generated_operation_types_are_named_as_expected() + { + _ = nameof(CreateSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketOperation.Meta); + _ = nameof(DeleteSupermarketOperation.Meta); + _ = nameof(UpdateSupermarketBackupStoreManagerRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(AddToSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(RemoveFromSupermarketCashiersRelationshipOperation.Meta); + _ = nameof(UpdateSupermarketStoreManagerRelationshipOperation.Meta); + + _ = nameof(CreateStaffMemberOperation.Meta); + _ = nameof(UpdateStaffMemberOperation.Meta); + _ = nameof(DeleteStaffMemberOperation.Meta); + } + + [Fact] + public void Generated_resource_field_types_are_named_as_expected() + { + _ = nameof(AttributesInCreateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInCreateSupermarketRequest.Kind); + _ = nameof(AttributesInUpdateSupermarketRequest.NameOfCity); + _ = nameof(AttributesInUpdateSupermarketRequest.Kind); + _ = nameof(AttributesInSupermarketResponse.NameOfCity); + _ = nameof(AttributesInSupermarketResponse.Kind); + _ = nameof(RelationshipsInCreateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInCreateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInUpdateSupermarketRequest.StoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.BackupStoreManager); + _ = nameof(RelationshipsInUpdateSupermarketRequest.Cashiers); + _ = nameof(RelationshipsInSupermarketResponse.StoreManager); + _ = nameof(RelationshipsInSupermarketResponse.BackupStoreManager); + _ = nameof(RelationshipsInSupermarketResponse.Cashiers); + _ = nameof(SupermarketType); + + _ = nameof(AttributesInCreateStaffMemberRequest.Name); + _ = nameof(AttributesInCreateStaffMemberRequest.Age); + _ = nameof(AttributesInUpdateStaffMemberRequest.Name); + _ = nameof(AttributesInUpdateStaffMemberRequest.Age); + _ = nameof(AttributesInStaffMemberResponse.Name); + _ = nameof(AttributesInStaffMemberResponse.Age); + } + + [Fact] + public void Generated_relationship_container_types_are_named_as_expected() + { + _ = nameof(ToOneStaffMemberInRequest.Meta); + _ = nameof(ToOneStaffMemberInResponse.Meta); + _ = nameof(NullableToOneStaffMemberInRequest.Meta); + _ = nameof(NullableToOneStaffMemberInResponse.Meta); + _ = nameof(ToManyStaffMemberInRequest.Meta); + _ = nameof(ToManyStaffMemberInResponse.Meta); + + _ = nameof(SupermarketBackupStoreManagerRelationshipIdentifier); + _ = nameof(SupermarketCashiersRelationshipIdentifier); + _ = nameof(SupermarketStoreManagerRelationshipIdentifier); + } + + [Fact] + public void Generated_relationship_name_enums_are_named_as_expected() + { + _ = nameof(SupermarketBackupStoreManagerRelationshipName.BackupStoreManager); + _ = nameof(SupermarketCashiersRelationshipName.Cashiers); + _ = nameof(SupermarketStoreManagerRelationshipName.StoreManager); + } + + [Fact] + public void Generated_resource_type_enums_are_named_as_expected() + { + _ = nameof(SupermarketResourceType.Supermarkets); + _ = nameof(StaffMemberResourceType.StaffMembers); + _ = nameof(ResourceType.Supermarkets); + _ = nameof(ResourceType.StaffMembers); + } + + [Fact] + public void Generated_operation_type_enums_are_named_as_expected() + { + _ = nameof(AddOperationCode.Add); + _ = nameof(UpdateOperationCode.Update); + _ = nameof(RemoveOperationCode.Remove); + } + + [Fact] + public void Generated_data_types_are_named_as_expected() + { + _ = nameof(ResourceInCreateRequest.Meta); + _ = nameof(ResourceInUpdateRequest.Meta); + _ = nameof(IdentifierInRequest.Meta); + _ = nameof(ResourceInResponse.Meta); + + _ = nameof(DataInCreateSupermarketRequest.Meta); + _ = nameof(DataInUpdateSupermarketRequest.Meta); + _ = nameof(DataInSupermarketResponse.Meta); + + _ = nameof(SupermarketIdentifierInRequest.Meta); + + _ = nameof(DataInCreateStaffMemberRequest.Meta); + _ = nameof(DataInUpdateStaffMemberRequest.Meta); + _ = nameof(DataInStaffMemberResponse.Meta); + + _ = nameof(StaffMemberIdentifierInRequest.Meta); + _ = nameof(StaffMemberIdentifierInResponse.Meta); + } + + [Fact] + public void Generated_predefined_types_are_named_as_expected() + { + _ = nameof(Jsonapi.Meta); + _ = nameof(ErrorObject.Meta); + _ = nameof(ErrorSource); + _ = nameof(Meta); + + _ = nameof(AtomicOperation.Meta); + _ = nameof(AtomicResult.Meta); + } +} diff --git a/test/OpenApiNSwagClientTests/ObjectExtensions.cs b/test/OpenApiNSwagClientTests/ObjectExtensions.cs new file mode 100644 index 0000000000..6be27b4e3b --- /dev/null +++ b/test/OpenApiNSwagClientTests/ObjectExtensions.cs @@ -0,0 +1,36 @@ +using System.Reflection; + +namespace OpenApiNSwagClientTests; + +internal static class ObjectExtensions +{ + public static object? GetPropertyValue(this object source, string propertyName) + { + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(propertyName); + + PropertyInfo propertyInfo = GetExistingProperty(source.GetType(), propertyName); + return propertyInfo.GetValue(source); + } + + public static void SetPropertyValue(this object source, string propertyName, object? value) + { + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(propertyName); + + PropertyInfo propertyInfo = GetExistingProperty(source.GetType(), propertyName); + propertyInfo.SetValue(source, value); + } + + private static PropertyInfo GetExistingProperty(Type type, string propertyName) + { + PropertyInfo? propertyInfo = type.GetProperty(propertyName); + + if (propertyInfo == null) + { + throw new InvalidOperationException($"Type '{type}' does not contain a property named '{propertyName}'."); + } + + return propertyInfo; + } +} diff --git a/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj b/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj new file mode 100644 index 0000000000..35a6ae73ff --- /dev/null +++ b/test/OpenApiNSwagClientTests/OpenApiNSwagClientTests.csproj @@ -0,0 +1,94 @@ + + + + net9.0 + + + + + + + + + + + + + + + + + + + + + + + internal + + + + + $(MSBuildProjectName).LegacyOpenApi.GeneratedCode + LegacyClient + %(ClassName).cs + false + false + false + + + KebabCase + $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + CamelCase + $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + PascalCase + $(MSBuildProjectName).NamingConventions.%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + NrtOffMsvOff + $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode + %(Name)Client + %(ClassName).cs + false + false + false + + + NrtOffMsvOn + $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode + %(Name)Client + %(ClassName).cs + false + false + false + + + NrtOnMsvOff + $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode + %(Name)Client + %(ClassName).cs + true + false + false + + + NrtOnMsvOn + $(MSBuildProjectName).ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode + %(Name)Client + %(ClassName).cs + true + false + false + + + diff --git a/test/OpenApiNSwagClientTests/PropertyInfoAssertionsExtensions.cs b/test/OpenApiNSwagClientTests/PropertyInfoAssertionsExtensions.cs new file mode 100644 index 0000000000..bb0ff8dbd1 --- /dev/null +++ b/test/OpenApiNSwagClientTests/PropertyInfoAssertionsExtensions.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using FluentAssertions; +using FluentAssertions.Types; + +namespace OpenApiNSwagClientTests; + +internal static class PropertyInfoAssertionsExtensions +{ + [CustomAssertion] + public static void HaveNullabilityState(this PropertyInfoAssertions source, NullabilityState expected, string because = "", params object[] becauseArgs) + { + PropertyInfo propertyInfo = source.Subject; + + NullabilityInfoContext nullabilityContext = new(); + NullabilityInfo nullabilityInfo = nullabilityContext.Create(propertyInfo); + + nullabilityInfo.ReadState.Should().Be(expected, because, becauseArgs); + nullabilityInfo.WriteState.Should().Be(expected, because, becauseArgs); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/CreateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/CreateResourceTests.cs new file mode 100644 index 0000000000..3e09f3b68f --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/CreateResourceTests.cs @@ -0,0 +1,252 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +public sealed class CreateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOffMsvOffFakers _fakers = new(); + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + object? defaultValue = SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().ContainPath(jsonPropertyName).With(attribute => attribute.Should().Be(defaultValue)); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Cannot_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a default value for property '{jsonPropertyName}'. Property requires a non-default value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToOne), "toOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToOne), "requiredToOne")] + public async Task Can_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath($"data.relationships.{jsonPropertyName}.data").With(relationshipDataObject => + { + relationshipDataObject.ValueKind.Should().Be(JsonValueKind.Null); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Cannot_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'data'. Property requires a value. Path 'data.relationships.{jsonPropertyName}'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToOne), "toOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NrtOffMsvOffFakers.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NrtOffMsvOffFakers.cs new file mode 100644 index 0000000000..b32063bade --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NrtOffMsvOffFakers.cs @@ -0,0 +1,23 @@ +using Bogus; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +internal sealed class NrtOffMsvOffFakers +{ + private readonly Lazy> _lazyPostAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyPatchAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyNullableToOneFaker = + new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyToManyFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + public Faker PostAttributes => _lazyPostAttributesFaker.Value; + public Faker PatchAttributes => _lazyPatchAttributesFaker.Value; + public Faker NullableToOne => _lazyNullableToOneFaker.Value; + public Faker ToMany => _lazyToManyFaker.Value; +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs new file mode 100644 index 0000000000..ff3b027b89 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs @@ -0,0 +1,44 @@ +using System.Reflection; +using FluentAssertions; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +public sealed class NullabilityTests +{ + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), NullabilityState.Unknown)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), NullabilityState.Unknown)] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), NullabilityState.Nullable)] + public void Nullability_of_generated_attribute_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? property = typeof(AttributesInCreateResourceRequest).GetProperty(propertyName); + + // Assert + property.Should().NotBeNull(); + property.Should().HaveNullabilityState(expectedState); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToOne), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToOne), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), NullabilityState.Unknown)] + public void Nullability_of_generated_relationship_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? relationshipProperty = typeof(RelationshipsInCreateResourceRequest).GetProperty(propertyName); + + // Assert + relationshipProperty.Should().NotBeNull(); + + PropertyInfo? dataProperty = relationshipProperty.PropertyType.GetProperty("Data"); + dataProperty.Should().NotBeNull(); + dataProperty.Should().HaveNullabilityState(expectedState); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/UpdateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/UpdateResourceTests.cs new file mode 100644 index 0000000000..ca5872c801 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/UpdateResourceTests.cs @@ -0,0 +1,133 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +public sealed class UpdateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOffMsvOffFakers _fakers = new(); + + [Fact] + public async Task Cannot_omit_Id() + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.PatchResourceAsync(Unknown.StringId.Int32, null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be("Cannot write a null value for property 'id'. Property requires a value. Path 'data'."); + } + + [Theory] + [InlineData(nameof(AttributesInUpdateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToOne), "toOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToOne), "requiredToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/CreateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/CreateResourceTests.cs new file mode 100644 index 0000000000..a1ca9ccc1f --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/CreateResourceTests.cs @@ -0,0 +1,323 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +public sealed class CreateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOffMsvOnFakers _fakers = new(); + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + object? defaultValue = SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().ContainPath(jsonPropertyName).With(attribute => attribute.Should().Be(defaultValue)); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + public async Task Cannot_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be($"Cannot write a null value for property '{jsonPropertyName}'. Property requires a value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Cannot_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a default value for property '{jsonPropertyName}'. Property requires a non-default value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToOne), "toOne")] + public async Task Can_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath($"data.relationships.{jsonPropertyName}.data").With(relationshipDataObject => + { + relationshipDataObject.ValueKind.Should().Be(JsonValueKind.Null); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToOne), "requiredToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Cannot_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'data'. Property requires a value. Path 'data.relationships.{jsonPropertyName}'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToOne), "toOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToOne), "requiredToOne")] + public async Task Cannot_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'id'. Property requires a value. Path 'data.relationships.{jsonPropertyName}.data'."); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NrtOffMsvOnFakers.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NrtOffMsvOnFakers.cs new file mode 100644 index 0000000000..8ffc94f6a9 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NrtOffMsvOnFakers.cs @@ -0,0 +1,26 @@ +using Bogus; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +internal sealed class NrtOffMsvOnFakers +{ + private readonly Lazy> _lazyPostAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyPatchAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyToOneFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyNullableToOneFaker = + new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyToManyFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + public Faker PostAttributes => _lazyPostAttributesFaker.Value; + public Faker PatchAttributes => _lazyPatchAttributesFaker.Value; + public Faker ToOne => _lazyToOneFaker.Value; + public Faker NullableToOne => _lazyNullableToOneFaker.Value; + public Faker ToMany => _lazyToManyFaker.Value; +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs new file mode 100644 index 0000000000..e6274f85b1 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs @@ -0,0 +1,44 @@ +using System.Reflection; +using FluentAssertions; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +public sealed class NullabilityTests +{ + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.ReferenceType), NullabilityState.Unknown)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredReferenceType), NullabilityState.Unknown)] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), NullabilityState.NotNull)] + public void Nullability_of_generated_attribute_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? property = typeof(AttributesInCreateResourceRequest).GetProperty(propertyName); + + // Assert + property.Should().NotBeNull(); + property.Should().HaveNullabilityState(expectedState); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToOne), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToOne), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), NullabilityState.Unknown)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), NullabilityState.Unknown)] + public void Nullability_of_generated_relationship_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? relationshipProperty = typeof(RelationshipsInCreateResourceRequest).GetProperty(propertyName); + + // Assert + relationshipProperty.Should().NotBeNull(); + + PropertyInfo? dataProperty = relationshipProperty.PropertyType.GetProperty("Data"); + dataProperty.Should().NotBeNull(); + dataProperty.Should().HaveNullabilityState(expectedState); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/UpdateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/UpdateResourceTests.cs new file mode 100644 index 0000000000..d92d2ca6a9 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/UpdateResourceTests.cs @@ -0,0 +1,133 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +public sealed class UpdateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOffMsvOnFakers _fakers = new(); + + [Fact] + public async Task Cannot_omit_Id() + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.PatchResourceAsync(Unknown.StringId.Int32, null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be("Cannot write a null value for property 'id'. Property requires a value. Path 'data'."); + } + + [Theory] + [InlineData(nameof(AttributesInUpdateResourceRequest.ReferenceType), "referenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredReferenceType), "requiredReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToOne), "toOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToOne), "requiredToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + ToOne = _fakers.NullableToOne.GenerateOne(), + RequiredToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOffMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/CreateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/CreateResourceTests.cs new file mode 100644 index 0000000000..d59bb1ba97 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/CreateResourceTests.cs @@ -0,0 +1,346 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +public sealed class CreateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOnMsvOffFakers _fakers = new(); + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + object? defaultValue = SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().ContainPath(jsonPropertyName).With(attribute => attribute.Should().Be(defaultValue)); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + public async Task Cannot_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().StartWith($"Cannot write a null value for property '{jsonPropertyName}'."); + assertion.Which.Message.Should().EndWith("Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Cannot_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a default value for property '{jsonPropertyName}'. Property requires a non-default value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), "nullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNullableToOne), "requiredNullableToOne")] + public async Task Can_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath($"data.relationships.{jsonPropertyName}.data").With(relationshipDataObject => + { + relationshipDataObject.ValueKind.Should().Be(JsonValueKind.Null); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Cannot_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'data'. Property requires a value. Path 'data.relationships.{jsonPropertyName}'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), "nullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + public async Task Cannot_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'id'. Property requires a value. Path 'data.relationships.{jsonPropertyName}.data'."); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NrtOnMsvOffFakers.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NrtOnMsvOffFakers.cs new file mode 100644 index 0000000000..e93076270c --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NrtOnMsvOffFakers.cs @@ -0,0 +1,26 @@ +using Bogus; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +internal sealed class NrtOnMsvOffFakers +{ + private readonly Lazy> _lazyPostAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyPatchAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyToOneFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyNullableToOneFaker = + new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyToManyFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + public Faker PostAttributes => _lazyPostAttributesFaker.Value; + public Faker PatchAttributes => _lazyPatchAttributesFaker.Value; + public Faker ToOne => _lazyToOneFaker.Value; + public Faker NullableToOne => _lazyNullableToOneFaker.Value; + public Faker ToMany => _lazyToManyFaker.Value; +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs new file mode 100644 index 0000000000..8c7e3baa45 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs @@ -0,0 +1,48 @@ +using System.Reflection; +using FluentAssertions; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +public sealed class NullabilityTests +{ + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), NullabilityState.Nullable)] + public void Nullability_of_generated_attribute_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? property = typeof(AttributesInCreateResourceRequest).GetProperty(propertyName); + + // Assert + property.Should().NotBeNull(); + property.Should().HaveNullabilityState(expectedState); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), NullabilityState.Nullable)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNullableToOne), NullabilityState.Nullable)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), NullabilityState.NotNull)] + public void Nullability_of_generated_relationship_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? relationshipProperty = typeof(RelationshipsInCreateResourceRequest).GetProperty(propertyName); + + // Assert + relationshipProperty.Should().NotBeNull(); + + PropertyInfo? dataProperty = relationshipProperty.PropertyType.GetProperty("Data"); + dataProperty.Should().NotBeNull(); + dataProperty.Should().HaveNullabilityState(expectedState); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/UpdateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/UpdateResourceTests.cs new file mode 100644 index 0000000000..ace64a2bb2 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/UpdateResourceTests.cs @@ -0,0 +1,143 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +public sealed class UpdateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOnMsvOffFakers _fakers = new(); + + [Fact] + public async Task Cannot_omit_Id() + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.PatchResourceAsync(Unknown.StringId.Int32, null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be("Cannot write a null value for property 'id'. Property requires a value. Path 'data'."); + } + + [Theory] + [InlineData(nameof(AttributesInUpdateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.NullableToOne), "nullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredNullableToOne), "requiredNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.NullableToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOffClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/CreateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/CreateResourceTests.cs new file mode 100644 index 0000000000..c54f675969 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/CreateResourceTests.cs @@ -0,0 +1,347 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +public sealed class CreateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOnMsvOnFakers _fakers = new(); + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + object? defaultValue = SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().ContainPath(jsonPropertyName).With(attribute => attribute.Should().Be(defaultValue)); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + public async Task Cannot_set_attribute_to_default_value(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToDefaultValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes, attributePropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be($"Cannot write a null value for property '{jsonPropertyName}'. Property requires a value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), "nullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Cannot_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a default value for property '{jsonPropertyName}'. Property requires a non-default value. Path 'data.attributes'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), "nullableToOne")] + public async Task Can_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath($"data.relationships.{jsonPropertyName}.data").With(relationshipDataObject => + { + relationshipDataObject.ValueKind.Should().Be(JsonValueKind.Null); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNullableToOne), "requiredNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Cannot_clear_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetDataPropertyToNull(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships, relationshipPropertyName); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'data'. Property requires a value. Path 'data.relationships.{jsonPropertyName}'."); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), "nullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResourceAsync(null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNullableToOne), "requiredNullableToOne")] + public async Task Cannot_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new CreateResourceRequestDocument + { + Data = new DataInCreateResourceRequest + { + Attributes = _fakers.PostAttributes.GenerateOne(), + Relationships = new RelationshipsInCreateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + Func action = async () => await apiClient.PostResourceAsync(null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be( + $"Cannot write a null value for property 'id'. Property requires a value. Path 'data.relationships.{jsonPropertyName}.data'."); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NrtOnMsvOnFakers.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NrtOnMsvOnFakers.cs new file mode 100644 index 0000000000..ccd784aff8 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NrtOnMsvOnFakers.cs @@ -0,0 +1,26 @@ +using Bogus; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +internal sealed class NrtOnMsvOnFakers +{ + private readonly Lazy> _lazyPostAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyPatchAttributesFaker = + new(FakerFactory.Instance.Create); + + private readonly Lazy> _lazyToOneFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyNullableToOneFaker = + new(FakerFactory.Instance.CreateForObjectWithResourceId); + + private readonly Lazy> _lazyToManyFaker = new(FakerFactory.Instance.CreateForObjectWithResourceId); + + public Faker PostAttributes => _lazyPostAttributesFaker.Value; + public Faker PatchAttributes => _lazyPatchAttributesFaker.Value; + public Faker ToOne => _lazyToOneFaker.Value; + public Faker NullableToOne => _lazyNullableToOneFaker.Value; + public Faker ToMany => _lazyToManyFaker.Value; +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs new file mode 100644 index 0000000000..15da38bfe1 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs @@ -0,0 +1,48 @@ +using System.Reflection; +using FluentAssertions; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +public sealed class NullabilityTests +{ + [Theory] + [InlineData(nameof(AttributesInCreateResourceRequest.NonNullableReferenceType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNonNullableReferenceType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableReferenceType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableReferenceType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.ValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredValueType), NullabilityState.NotNull)] + [InlineData(nameof(AttributesInCreateResourceRequest.NullableValueType), NullabilityState.Nullable)] + [InlineData(nameof(AttributesInCreateResourceRequest.RequiredNullableValueType), NullabilityState.NotNull)] + public void Nullability_of_generated_attribute_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? property = typeof(AttributesInCreateResourceRequest).GetProperty(propertyName); + + // Assert + property.Should().NotBeNull(); + property.Should().HaveNullabilityState(expectedState); + } + + [Theory] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NonNullableToOne), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNonNullableToOne), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.NullableToOne), NullabilityState.Nullable)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredNullableToOne), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.ToMany), NullabilityState.NotNull)] + [InlineData(nameof(RelationshipsInCreateResourceRequest.RequiredToMany), NullabilityState.NotNull)] + public void Nullability_of_generated_relationship_property_is_as_expected(string propertyName, NullabilityState expectedState) + { + // Act + PropertyInfo? relationshipProperty = typeof(RelationshipsInCreateResourceRequest).GetProperty(propertyName); + + // Assert + relationshipProperty.Should().NotBeNull(); + + PropertyInfo? dataProperty = relationshipProperty.PropertyType.GetProperty("Data"); + dataProperty.Should().NotBeNull(); + dataProperty.Should().HaveNullabilityState(expectedState); + } +} diff --git a/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/UpdateResourceTests.cs b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/UpdateResourceTests.cs new file mode 100644 index 0000000000..ce6774f834 --- /dev/null +++ b/test/OpenApiNSwagClientTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/UpdateResourceTests.cs @@ -0,0 +1,143 @@ +using System.Net; +using System.Text.Json; +using FluentAssertions; +using FluentAssertions.Specialized; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Newtonsoft.Json; +using OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn.GeneratedCode; +using TestBuildingBlocks; +using Xunit; + +namespace OpenApiNSwagClientTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +public sealed class UpdateResourceTests : BaseOpenApiNSwagClientTests +{ + private readonly NrtOnMsvOnFakers _fakers = new(); + + [Fact] + public async Task Cannot_omit_Id() + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + // Act + Func action = async () => await apiClient.PatchResourceAsync(Unknown.StringId.Int32, null, requestBody); + + // Assert + ExceptionAssertions assertion = await action.Should().ThrowExactlyAsync(); + + assertion.Which.Message.Should().Be("Cannot write a null value for property 'id'. Property requires a value. Path 'data'."); + } + + [Theory] + [InlineData(nameof(AttributesInUpdateResourceRequest.NonNullableReferenceType), "nonNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNonNullableReferenceType), "requiredNonNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableReferenceType), "nullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableReferenceType), "requiredNullableReferenceType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.ValueType), "valueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredValueType), "requiredValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.NullableValueType), "nullableValueType")] + [InlineData(nameof(AttributesInUpdateResourceRequest.RequiredNullableValueType), "requiredNullableValueType")] + public async Task Can_omit_attribute(string attributePropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Attributes, attributePropertyName); + apiClient.MarkAsTracked(requestBody.Data.Attributes); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.attributes").With(attributesObject => + { + attributesObject.Should().NotContainPath(jsonPropertyName); + }); + } + + [Theory] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.NonNullableToOne), "nonNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredNonNullableToOne), "requiredNonNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.NullableToOne), "nullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredNullableToOne), "requiredNullableToOne")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.ToMany), "toMany")] + [InlineData(nameof(RelationshipsInUpdateResourceRequest.RequiredToMany), "requiredToMany")] + public async Task Can_omit_relationship(string relationshipPropertyName, string jsonPropertyName) + { + // Arrange + var requestBody = new UpdateResourceRequestDocument + { + Data = new DataInUpdateResourceRequest + { + Id = Unknown.StringId.Int32, + Attributes = _fakers.PatchAttributes.GenerateOne(), + Relationships = new RelationshipsInUpdateResourceRequest + { + NonNullableToOne = _fakers.ToOne.GenerateOne(), + RequiredNonNullableToOne = _fakers.ToOne.GenerateOne(), + NullableToOne = _fakers.NullableToOne.GenerateOne(), + RequiredNullableToOne = _fakers.ToOne.GenerateOne(), + ToMany = _fakers.ToMany.GenerateOne(), + RequiredToMany = _fakers.ToMany.GenerateOne() + } + } + }; + + using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null); + var apiClient = new NrtOnMsvOnClient(wrapper.HttpClient); + + SetPropertyToInitialValue(requestBody.Data.Relationships, relationshipPropertyName); + apiClient.MarkAsTracked(requestBody.Data.Relationships); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResourceAsync(requestBody.Data.Id, null, requestBody)); + + // Assert + JsonElement document = wrapper.GetRequestBodyAsJson(); + + document.Should().ContainPath("data.relationships").With(relationshipsObject => + { + relationshipsObject.Should().NotContainPath(jsonPropertyName); + }); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/.editorconfig b/test/OpenApiNSwagEndToEndTests/.editorconfig new file mode 100644 index 0000000000..e2ec1cac44 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/.editorconfig @@ -0,0 +1,3 @@ +# Workaround for incorrect nullability in NSwag generated clients. +[*Client.cs] +dotnet_diagnostic.CS8765.severity = none diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs new file mode 100644 index 0000000000..e2cb3f9ed7 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicCreateResourceTests.cs @@ -0,0 +1,205 @@ +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; +using CreateTeacherOperation = OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode.CreateTeacherOperation; + +namespace OpenApiNSwagEndToEndTests.AtomicOperations; + +public sealed class AtomicCreateResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly OperationsFakers _fakers; + + public AtomicCreateResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_create_resource_with_attributes() + { + // Arrange + Teacher newTeacher = _fakers.Teacher.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateTeacherOperation + { + Data = new DataInCreateTeacherRequest + { + Attributes = new AttributesInCreateTeacherRequest + { + Name = newTeacher.Name, + EmailAddress = newTeacher.EmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(1); + DataInTeacherResponse teacherData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + + long newTeacherId = long.Parse(teacherData.Id); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.FirstWithIdAsync(newTeacherId); + + teacherInDatabase.Name.Should().Be(newTeacher.Name); + teacherInDatabase.EmailAddress.Should().Be(newTeacher.EmailAddress); + }); + } + + [Fact] + public async Task Can_create_resource_with_attributes_and_relationships() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + Course existingCourse = _fakers.Course.GenerateOne(); + Enrollment newEnrollment = _fakers.Enrollment.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingStudent, existingCourse); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateEnrollmentOperation + { + Data = new DataInCreateEnrollmentRequest + { + Attributes = new AttributesInCreateEnrollmentRequest + { + EnrolledAt = newEnrollment.EnrolledAt.ToDateTime(TimeOnly.MinValue) + }, + Relationships = new RelationshipsInCreateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Id = existingCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Id = existingStudent.StringId! + } + } + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(1); + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrollment.EnrolledAt.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.GraduatedAt.Should().BeNull(); + enrollmentData.Attributes.HasGraduated.Should().BeFalse(); + + long newEnrollmentId = long.Parse(enrollmentData.Id); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment enrollmentInDatabase = await dbContext.Enrollments.FirstWithIdAsync(newEnrollmentId); + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrollment.EnrolledAt); + enrollmentInDatabase.GraduatedAt.Should().BeNull(); + enrollmentInDatabase.HasGraduated.Should().BeFalse(); + }); + } + + [Fact] + public async Task Can_create_resource_with_client_generated_ID() + { + // Arrange + Course newCourse = _fakers.Course.GenerateOne(); + newCourse.Id = Guid.NewGuid(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateCourseOperation + { + Data = new DataInCreateCourseRequest + { + Id = newCourse.Id, + Attributes = new AttributesInCreateCourseRequest + { + Subject = newCourse.Subject + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Course courseInDatabase = await dbContext.Courses.FirstWithIdAsync(newCourse.Id); + + courseInDatabase.Subject.Should().Be(newCourse.Subject); + courseInDatabase.Description.Should().BeNull(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs new file mode 100644 index 0000000000..d183c464aa --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicDeleteResourceTests.cs @@ -0,0 +1,78 @@ +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.AtomicOperations; + +public sealed class AtomicDeleteResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly OperationsFakers _fakers; + + public AtomicDeleteResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_delete_resource() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Enrollments.Add(existingEnrollment); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new DeleteEnrollmentOperation + { + Ref = new EnrollmentIdentifierInRequest + { + Id = existingEnrollment.StringId! + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment? enrollmentInDatabase = await dbContext.Enrollments.FirstWithIdOrDefaultAsync(existingEnrollment.Id); + + enrollmentInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs new file mode 100644 index 0000000000..daf994d3bb --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicLocalIdTests.cs @@ -0,0 +1,217 @@ +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.AtomicOperations; + +public sealed class AtomicLocalIdTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly OperationsFakers _fakers; + + public AtomicLocalIdTests(IntegrationTestContext, OperationsDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_use_local_IDs() + { + // Arrange + Teacher newTeacher = _fakers.Teacher.GenerateOne(); + Course newCourse = _fakers.Course.GenerateOne(); + newCourse.Id = Guid.NewGuid(); + Student newStudent = _fakers.Student.GenerateOne(); + DateOnly newEnrolledAt = _fakers.Enrollment.GenerateOne().EnrolledAt; + + const string teacherLocalId = "teacher-1"; + const string studentLocalId = "student-1"; + const string enrollmentLocalId = "enrollment-1"; + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateTeacherOperation + { + Data = new DataInCreateTeacherRequest + { + Lid = teacherLocalId, + Attributes = new AttributesInCreateTeacherRequest + { + Name = newTeacher.Name, + EmailAddress = newTeacher.EmailAddress + } + } + }, + new CreateCourseOperation + { + Data = new DataInCreateCourseRequest + { + Id = newCourse.Id, + Attributes = new AttributesInCreateCourseRequest + { + Subject = newCourse.Subject, + Description = newCourse.Description + } + } + }, + new AddToTeacherTeachesRelationshipOperation + { + Ref = new TeacherTeachesRelationshipIdentifier + { + Lid = teacherLocalId + }, + Data = + [ + new CourseIdentifierInRequest + { + Id = newCourse.Id + } + ] + }, + new CreateStudentOperation + { + Data = new DataInCreateStudentRequest + { + Lid = studentLocalId, + Attributes = new AttributesInCreateStudentRequest + { + Name = newStudent.Name, + EmailAddress = newStudent.EmailAddress + } + } + }, + new CreateEnrollmentOperation + { + Data = new DataInCreateEnrollmentRequest + { + Lid = enrollmentLocalId, + Attributes = new AttributesInCreateEnrollmentRequest + { + EnrolledAt = newEnrolledAt.ToDateTime(TimeOnly.MinValue) + }, + Relationships = new RelationshipsInCreateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Id = newCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Lid = studentLocalId + } + } + } + } + }, + new UpdateStudentMentorRelationshipOperation + { + Ref = new StudentMentorRelationshipIdentifier + { + Lid = studentLocalId + }, + Data = new TeacherIdentifierInRequest + { + Lid = teacherLocalId + } + }, + new DeleteTeacherOperation + { + Ref = new TeacherIdentifierInRequest + { + Lid = teacherLocalId + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(7); + + DataInTeacherResponse teacherData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + teacherData.Attributes.Should().NotBeNull(); + teacherData.Attributes.Name.Should().Be(newTeacher.Name); + teacherData.Attributes.EmailAddress.Should().Be(newTeacher.EmailAddress); + long newTeacherId = long.Parse(teacherData.Id); + + response.Atomic_results.ElementAt(1).Data.Should().BeNull(); + response.Atomic_results.ElementAt(2).Data.Should().BeNull(); + + DataInStudentResponse studentData = response.Atomic_results.ElementAt(3).Data.Should().BeOfType().Which; + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newStudent.EmailAddress); + long newStudentId = long.Parse(studentData.Id); + + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(4).Data.Should().BeOfType().Which; + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); + long newEnrollmentId = long.Parse(enrollmentData.Id); + + response.Atomic_results.ElementAt(5).Data.Should().BeNull(); + response.Atomic_results.ElementAt(6).Data.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher? teacherInDatabase = await dbContext.Teachers.FirstWithIdOrDefaultAsync(newTeacherId); + teacherInDatabase.Should().BeNull(); + + Course courseInDatabase = await dbContext.Courses.Include(course => course.TaughtBy).FirstWithIdAsync(newCourse.Id); + courseInDatabase.Subject.Should().Be(newCourse.Subject); + courseInDatabase.Description.Should().Be(newCourse.Description); + courseInDatabase.TaughtBy.Should().BeEmpty(); + + Student studentInDatabase = await dbContext.Students.Include(student => student.Mentor).FirstWithIdAsync(newStudentId); + studentInDatabase.Name.Should().Be(newStudent.Name); + studentInDatabase.EmailAddress.Should().Be(newStudent.EmailAddress); + studentInDatabase.Mentor.Should().BeNull(); + + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + Enrollment enrollmentInDatabase = await dbContext.Enrollments + .Include(enrollment => enrollment.Course) + .Include(enrollment => enrollment.Student) + .FirstWithIdAsync(newEnrollmentId); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrolledAt); + enrollmentInDatabase.Course.Should().NotBeNull(); + enrollmentInDatabase.Course.Id.Should().Be(newCourse.Id); + enrollmentInDatabase.Student.Id.Should().Be(newStudentId); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs new file mode 100644 index 0000000000..39863bd8c7 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicRelationshipTests.cs @@ -0,0 +1,261 @@ +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.AtomicOperations; + +public sealed class AtomicRelationshipTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly OperationsFakers _fakers; + + public AtomicRelationshipTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_update_ToOne_relationship() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + Student existingStudent = _fakers.Student.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingEnrollment, existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new UpdateEnrollmentStudentRelationshipOperation + { + Ref = new EnrollmentStudentRelationshipIdentifier + { + Id = existingEnrollment.StringId! + }, + Data = new StudentIdentifierInRequest + { + Id = existingStudent.StringId! + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Enrollment enrollmentInDatabase = await dbContext.Enrollments.Include(enrollment => enrollment.Student).FirstWithIdAsync(existingEnrollment.Id); + + enrollmentInDatabase.Student.Should().NotBeNull(); + enrollmentInDatabase.Student.Id.Should().Be(existingStudent.Id); + }); + } + + [Fact] + public async Task Can_update_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(1); + List existingCourses = _fakers.Course.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + dbContext.AddRange(existingCourses); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new UpdateTeacherTeachesRelationshipOperation + { + Ref = new TeacherTeachesRelationshipIdentifier + { + Id = existingTeacher.StringId! + }, + Data = + [ + new CourseIdentifierInRequest + { + Id = existingCourses.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Id = existingCourses.ElementAt(1).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(2); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(1).Id); + }); + } + + [Fact] + public async Task Can_add_to_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(1); + List existingCourses = _fakers.Course.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + dbContext.AddRange(existingCourses); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new AddToTeacherTeachesRelationshipOperation + { + Ref = new TeacherTeachesRelationshipIdentifier + { + Id = existingTeacher.StringId! + }, + Data = + [ + new CourseIdentifierInRequest + { + Id = existingCourses.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Id = existingCourses.ElementAt(1).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(3); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingTeacher.Teaches.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(0).Id); + teacherInDatabase.Teaches.Should().ContainSingle(course => course.Id == existingCourses.ElementAt(1).Id); + }); + } + + [Fact] + public async Task Can_remove_from_ToMany_relationship() + { + // Arrange + Teacher existingTeacher = _fakers.Teacher.GenerateOne(); + existingTeacher.Teaches = _fakers.Course.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Add(existingTeacher); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new RemoveFromTeacherTeachesRelationshipOperation + { + Ref = new TeacherTeachesRelationshipIdentifier + { + Id = existingTeacher.StringId! + }, + Data = + [ + new CourseIdentifierInRequest + { + Id = existingTeacher.Teaches.ElementAt(0).Id + }, + new CourseIdentifierInRequest + { + Id = existingTeacher.Teaches.ElementAt(2).Id + } + ] + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Teacher teacherInDatabase = await dbContext.Teachers.Include(teacher => teacher.Teaches).FirstWithIdAsync(existingTeacher.Id); + + teacherInDatabase.Teaches.Should().HaveCount(1); + teacherInDatabase.Teaches.ElementAt(0).Id.Should().Be(existingTeacher.Teaches.ElementAt(1).Id); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs new file mode 100644 index 0000000000..daf3704503 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/AtomicOperations/AtomicUpdateResourceTests.cs @@ -0,0 +1,254 @@ +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.AtomicOperations.GeneratedCode; +using OpenApiTests; +using OpenApiTests.AtomicOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.AtomicOperations; + +public sealed class AtomicUpdateResourceTests : IClassFixture, OperationsDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, OperationsDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly OperationsFakers _fakers; + + public AtomicUpdateResourceTests(IntegrationTestContext, OperationsDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>))); + + _fakers = new OperationsFakers(testContext.Factory.Services); + } + + [Fact] + public async Task Can_update_resource_with_attributes() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + string newName = _fakers.Student.GenerateOne().Name; + string? newEmailAddress = _fakers.Student.GenerateOne().EmailAddress; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Students.Add(existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new UpdateStudentOperation + { + Data = new DataInUpdateStudentRequest + { + Id = existingStudent.StringId!, + Attributes = new AttributesInUpdateStudentRequest + { + Name = newName, + EmailAddress = newEmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(1); + DataInStudentResponse studentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(newName); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Student studentInDatabase = await dbContext.Students.FirstWithIdAsync(existingStudent.Id); + + studentInDatabase.Name.Should().Be(newName); + studentInDatabase.EmailAddress.Should().Be(newEmailAddress); + }); + } + + [Fact] + public async Task Can_update_resource_with_attributes_using_ref() + { + // Arrange + Student existingStudent = _fakers.Student.GenerateOne(); + string? newEmailAddress = _fakers.Student.GenerateOne().EmailAddress; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Students.Add(existingStudent); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new UpdateStudentOperation + { + Ref = new StudentIdentifierInRequest + { + Id = existingStudent.StringId! + }, + Data = new DataInUpdateStudentRequest + { + Id = existingStudent.StringId!, + Attributes = new AttributesInUpdateStudentRequest + { + EmailAddress = newEmailAddress + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(1); + DataInStudentResponse studentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + + studentData.Id.Should().Be(existingStudent.StringId); + studentData.Attributes.Should().NotBeNull(); + studentData.Attributes.Name.Should().Be(existingStudent.Name); + studentData.Attributes.EmailAddress.Should().Be(newEmailAddress); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Student studentInDatabase = await dbContext.Students.FirstWithIdAsync(existingStudent.Id); + + studentInDatabase.Name.Should().Be(existingStudent.Name); + studentInDatabase.EmailAddress.Should().Be(newEmailAddress); + }); + } + + [Fact] + public async Task Can_update_resource_with_attributes_and_relationships() + { + // Arrange + Enrollment existingEnrollment = _fakers.Enrollment.GenerateOne(); + existingEnrollment.Student = _fakers.Student.GenerateOne(); + existingEnrollment.Course = _fakers.Course.GenerateOne(); + + Student existingStudent = _fakers.Student.GenerateOne(); + Course existingCourse = _fakers.Course.GenerateOne(); + DateOnly newEnrolledAt = _fakers.Enrollment.GenerateOne().EnrolledAt; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.AddInRange(existingEnrollment, existingStudent, existingCourse); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new AtomicOperationsClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new UpdateEnrollmentOperation + { + Data = new DataInUpdateEnrollmentRequest + { + Id = existingEnrollment.StringId!, + Attributes = new AttributesInUpdateEnrollmentRequest + { + EnrolledAt = newEnrolledAt.ToDateTime(TimeOnly.MinValue) + }, + Relationships = new RelationshipsInUpdateEnrollmentRequest + { + Course = new ToOneCourseInRequest + { + Data = new CourseIdentifierInRequest + { + Id = existingCourse.Id + } + }, + Student = new ToOneStudentInRequest + { + Data = new StudentIdentifierInRequest + { + Id = existingStudent.StringId! + } + } + } + } + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + response.Atomic_results.Should().HaveCount(1); + DataInEnrollmentResponse enrollmentData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Which; + + enrollmentData.Id.Should().Be(existingEnrollment.StringId); + enrollmentData.Attributes.Should().NotBeNull(); + enrollmentData.Attributes.EnrolledAt.Should().Be(newEnrolledAt.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.GraduatedAt.Should().Be(existingEnrollment.GraduatedAt!.Value.ToDateTime(TimeOnly.MinValue)); + enrollmentData.Attributes.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + Enrollment enrollmentInDatabase = await dbContext.Enrollments + .Include(enrollment => enrollment.Student) + .Include(enrollment => enrollment.Course) + .FirstWithIdAsync(existingEnrollment.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + enrollmentInDatabase.EnrolledAt.Should().Be(newEnrolledAt); + enrollmentInDatabase.GraduatedAt.Should().Be(existingEnrollment.GraduatedAt); + enrollmentInDatabase.HasGraduated.Should().Be(existingEnrollment.HasGraduated); + + enrollmentInDatabase.Student.Should().NotBeNull(); + enrollmentInDatabase.Student.Id.Should().Be(existingStudent.Id); + + enrollmentInDatabase.Course.Should().NotBeNull(); + enrollmentInDatabase.Course.Id.Should().Be(existingCourse.Id); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs b/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs new file mode 100644 index 0000000000..dc0d14d45c --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ClientIdGenerationModes/ClientIdGenerationModesTests.cs @@ -0,0 +1,263 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.ClientIdGenerationModes.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ClientIdGenerationModes; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ClientIdGenerationModes; + +public sealed class ClientIdGenerationModesTests + : IClassFixture, ClientIdGenerationDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ClientIdGenerationDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ClientIdGenerationFakers _fakers = new(); + + public ClientIdGenerationModesTests(IntegrationTestContext, ClientIdGenerationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + } + + [Fact] + public async Task Cannot_create_resource_without_ID_when_supplying_ID_is_required() + { + // Arrange + Player newPlayer = _fakers.Player.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreatePlayerRequestDocument + { + Data = new DataInCreatePlayerRequest + { + Attributes = new AttributesInCreatePlayerRequest + { + UserName = newPlayer.UserName + } + } + }; + + // Act + Func action = async () => await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerAsync(requestBody)); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); + exception.Message.Should().Be("HTTP 422: Validation of the request body failed."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("422"); + error.Title.Should().Be("Failed to deserialize request body: The 'id' element is invalid."); + error.Detail.Should().BeNull(); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/data"); + } + + [Fact] + public async Task Can_create_resource_with_ID_when_supplying_ID_is_required() + { + // Arrange + Player newPlayer = _fakers.Player.GenerateOne(); + newPlayer.Id = Guid.NewGuid(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreatePlayerRequestDocument + { + Data = new DataInCreatePlayerRequest + { + Id = newPlayer.Id, + Attributes = new AttributesInCreatePlayerRequest + { + UserName = newPlayer.UserName + } + } + }; + + // Act + PrimaryPlayerResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Player playerInDatabase = await dbContext.Players.FirstWithIdAsync(newPlayer.Id); + + playerInDatabase.UserName.Should().Be(newPlayer.UserName); + }); + } + + [Fact] + public async Task Can_create_resource_without_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game newGame = _fakers.Game.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Attributes = new AttributesInCreateGameRequest + { + Title = newGame.Title, + PurchasePrice = (double)newGame.PurchasePrice + } + } + }; + + // Act + PrimaryGameResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + response.Data.Id.Should().NotBe(Guid.Empty); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Game gameInDatabase = await dbContext.Games.FirstWithIdAsync(response.Data.Id); + + gameInDatabase.Title.Should().Be(newGame.Title); + gameInDatabase.PurchasePrice.Should().Be(newGame.PurchasePrice); + }); + } + + [Fact] + public async Task Can_create_resource_with_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game newGame = _fakers.Game.GenerateOne(); + newGame.Id = Guid.NewGuid(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Id = newGame.Id, + Attributes = new AttributesInCreateGameRequest + { + Title = newGame.Title, + PurchasePrice = (double)newGame.PurchasePrice + } + } + }; + + // Act + PrimaryGameResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostGameAsync(requestBody)); + + // Assert + response.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Game gameInDatabase = await dbContext.Games.FirstWithIdAsync(newGame.Id); + + gameInDatabase.Title.Should().Be(newGame.Title); + gameInDatabase.PurchasePrice.Should().Be(newGame.PurchasePrice); + }); + } + + [Fact] + public async Task Cannot_create_resource_with_existing_ID_when_supplying_ID_is_allowed() + { + // Arrange + Game existingGame = _fakers.Game.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Games.Add(existingGame); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreateGameRequestDocument + { + Data = new DataInCreateGameRequest + { + Id = existingGame.Id, + Attributes = new AttributesInCreateGameRequest + { + Title = existingGame.Title, + PurchasePrice = (double)existingGame.PurchasePrice + } + } + }; + + // Act + Func action = async () => _ = await apiClient.PostGameAsync(requestBody); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Message.Should().Be("HTTP 409: The request body contains conflicting information or another resource with the same ID already exists."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Another resource with the specified ID already exists."); + error.Detail.Should().Be($"Another resource of type 'games' with ID '{existingGame.StringId}' already exists."); + } + + [Fact] + public async Task Can_create_resource_without_ID_when_supplying_ID_is_forbidden() + { + // Arrange + PlayerGroup newPlayerGroup = _fakers.Group.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ClientIdGenerationModesClient apiClient = new(httpClient); + + var requestBody = new CreatePlayerGroupRequestDocument + { + Data = new DataInCreatePlayerGroupRequest + { + Attributes = new AttributesInCreatePlayerGroupRequest + { + Name = newPlayerGroup.Name + } + } + }; + + // Act + PrimaryPlayerGroupResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostPlayerGroupAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + response.Data.Id.Should().NotBeNullOrEmpty(); + + long newPlayerGroupId = long.Parse(response.Data.Id); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + PlayerGroup playerGroupInDatabase = await dbContext.PlayerGroups.FirstWithIdAsync(newPlayerGroupId); + + playerGroupInDatabase.Name.Should().Be(newPlayerGroup.Name); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs b/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs new file mode 100644 index 0000000000..88e9f84a01 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/Headers/ETagTests.cs @@ -0,0 +1,208 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.Net.Http.Headers; +using OpenApiNSwagEndToEndTests.Headers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.Headers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.Headers; + +public sealed class ETagTests : IClassFixture, HeaderDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, HeaderDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly HeaderFakers _fakers = new(); + + public ETagTests(IntegrationTestContext, HeaderDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Returns_ETag_for_HEAD_request() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.HeadCountryCollectionAsync(); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] eTagHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + } + + [Fact] + public async Task Returns_ETag_for_GET_request() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.GetCountryCollectionAsync(); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] eTagHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + + response.Result.Should().NotBeNull(); + } + + [Fact] + public async Task Returns_no_ETag_for_failed_GET_request() + { + // Arrange + Guid unknownCountryId = Unknown.TypedId.Guid; + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + Func action = async () => await apiClient.GetCountryAsync(unknownCountryId); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The country does not exist."); + exception.Headers.Should().NotContainKey(HeaderNames.ETag); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'countries' with ID '{unknownCountryId}' does not exist."); + } + + [Fact] + public async Task Returns_no_ETag_for_POST_request() + { + // Arrange + Country newCountry = _fakers.Country.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + var requestBody = new CreateCountryRequestDocument + { + Data = new DataInCreateCountryRequest + { + Attributes = new AttributesInCreateCountryRequest + { + Name = newCountry.Name, + Population = newCountry.Population + } + } + }; + + // Act + ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.Created); + + response.Headers.Should().NotContainKey(HeaderNames.ETag); + + response.Result.Should().NotBeNull(); + } + + [Fact] + public async Task Returns_NotModified_for_matching_ETag() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + ApiResponse response1 = await apiClient.GetCountryCollectionAsync(); + + string responseETag = response1.Headers[HeaderNames.ETag].Single(); + + // Act + ApiResponse response2 = + await ApiResponse.TranslateAsync(async () => await apiClient.GetCountryCollectionAsync(null, responseETag)); + + // Assert + response2.StatusCode.Should().Be((int)HttpStatusCode.NotModified); + + string[] eTagHeaderValues = response2.Headers.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Be(responseETag); + + response2.Result.Should().BeNull(); + } + + [Fact] + public async Task Returns_content_for_mismatching_ETag() + { + // Arrange + List countries = _fakers.Country.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.AddRange(countries); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.GetCountryCollectionAsync(null, "\"Not-a-matching-value\""); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] eTagHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ETag).WhoseValue.ToArray(); + eTagHeaderValues.Should().HaveCount(1); + eTagHeaderValues[0].Should().Match("\"*\""); + + response.Result.Should().NotBeNull(); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs b/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs new file mode 100644 index 0000000000..b93912ea56 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/Headers/HeaderTests.cs @@ -0,0 +1,173 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.Net.Http.Headers; +using OpenApiNSwagEndToEndTests.Headers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.Headers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.Headers; + +public sealed class HeaderTests : IClassFixture, HeaderDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, HeaderDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly HeaderFakers _fakers = new(); + + public HeaderTests(IntegrationTestContext, HeaderDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Returns_Location_for_post_resource_request() + { + // Arrange + Country newCountry = _fakers.Country.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + var requestBody = new CreateCountryRequestDocument + { + Data = new DataInCreateCountryRequest + { + Attributes = new AttributesInCreateCountryRequest + { + Name = newCountry.Name, + Population = newCountry.Population + } + } + }; + + // Act + ApiResponse response = await ApiResponse.TranslateAsync(async () => await apiClient.PostCountryAsync(requestBody)); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.Created); + + response.Result.Should().NotBeNull(); + + string[] locationHeaderValues = response.Headers.Should().ContainKey(HeaderNames.Location).WhoseValue.ToArray(); + locationHeaderValues.Should().HaveCount(1); + locationHeaderValues[0].Should().Be($"/countries/{response.Result.Data.Id}"); + } + + [Fact] + public async Task Returns_ContentLength_for_head_primary_resources_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.HeadCountryCollectionAsync(); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] contentLengthHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_primary_resource_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.HeadCountryAsync(existingCountry.Id); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] contentLengthHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_secondary_resource_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + existingCountry.Languages = _fakers.Language.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.HeadCountryLanguagesAsync(existingCountry.Id); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] contentLengthHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + [Fact] + public async Task Returns_ContentLength_for_head_relationship_request() + { + // Arrange + Country existingCountry = _fakers.Country.GenerateOne(); + existingCountry.Languages = _fakers.Language.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Countries.Add(existingCountry); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new HeadersClient(httpClient); + + // Act + ApiResponse response = await apiClient.HeadCountryLanguagesRelationshipAsync(existingCountry.Id); + + // Assert + response.StatusCode.Should().Be((int)HttpStatusCode.OK); + + string[] contentLengthHeaderValues = response.Headers.Should().ContainKey(HeaderNames.ContentLength).WhoseValue.ToArray(); + contentLengthHeaderValues.Should().HaveCount(1); + long.Parse(contentLengthHeaderValues[0]).Should().BeGreaterThan(0); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs new file mode 100644 index 0000000000..1166a8bc0d --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/Links/AlternateOpenApiRouteTests.cs @@ -0,0 +1,56 @@ +using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.Links.GeneratedCode; +using OpenApiTests; +using OpenApiTests.Links; +using Swashbuckle.AspNetCore.Swagger; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.Links; + +public sealed class AlternateOpenApiRouteTests : IClassFixture, LinkDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, LinkDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly LinkFakers _fakers = new(); + + public AlternateOpenApiRouteTests(IntegrationTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.ConfigureServices(services => + services.Configure(options => options.RouteTemplate = "/api-docs/{documentName}/swagger.yaml")); + + testContext.UseController(); + } + + [Fact] + public async Task DescribedBy_link_matches_alternate_OpenAPI_route() + { + // Arrange + Excursion excursion = _fakers.Excursion.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new LinksClient(httpClient); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Excursions.Add(excursion); + await dbContext.SaveChangesAsync(); + }); + + // Act + PrimaryExcursionResponseDocument response = await apiClient.GetExcursionAsync(excursion.StringId!); + + // Assert + response.Links.Describedby.Should().Be("/api-docs/v1/swagger.yaml"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs b/test/OpenApiNSwagEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs new file mode 100644 index 0000000000..bc15e6ee62 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ModelStateValidation/ModelStateValidationTests.cs @@ -0,0 +1,551 @@ +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.ModelStateValidation.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ModelStateValidation; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ModelStateValidation; + +public sealed class ModelStateValidationTests + : IClassFixture, ModelStateValidationDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ModelStateValidationDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ModelStateValidationFakers _fakers = new(); + + public ModelStateValidationTests(IntegrationTestContext, ModelStateValidationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + var options = testContext.Factory.Services.GetRequiredService(); + options.SerializerOptions.Converters.Add(new UtcDateTimeJsonConverter()); + } + + [Theory] + [InlineData("a")] + [InlineData("abcdefghijklmnopqrstu")] + public async Task Cannot_exceed_length_constraint(string firstName) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + FirstName = firstName, + LastName = newAccount.LastName + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field FirstName must be a string or collection type with a minimum length of '2' and maximum length of '20'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/firstName"); + } + + [Theory] + [InlineData("ab")] + [InlineData("abcdefghijklmnopqrs")] + public async Task Cannot_exceed_string_length_constraint(string userName) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + UserName = userName + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field UserName must be a string with a minimum length of 3 and a maximum length of 18."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/userName"); + } + + [Fact] + public async Task Cannot_violate_regular_expression_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + UserName = "aB1" + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("Only letters are allowed."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/userName"); + } + + [Fact] + public async Task Cannot_use_invalid_credit_card_number() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + CreditCard = "123-456" + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The CreditCard field is not a valid credit card number."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/creditCard"); + } + + [Fact] + public async Task Cannot_use_invalid_email_address() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Email = "abc" + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The Email field is not a valid e-mail address."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/email"); + } + + [Fact] + public async Task Cannot_exceed_min_length_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + // Using -3 instead of -1 to compensate for base64 padding. + Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MinPasswordChars - 3).ToArray() + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + const int minCharsInBase64 = SocialMediaAccount.MinPasswordCharsInBase64; + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Password must be a string or array type with a minimum length of '{minCharsInBase64}'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/password"); + } + + [Fact] + public async Task Cannot_exceed_max_length_constraint() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Password = Enumerable.Repeat((byte)'X', SocialMediaAccount.MaxPasswordChars + 1).ToArray() + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + const int maxCharsInBase64 = SocialMediaAccount.MaxPasswordCharsInBase64; + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Password must be a string or array type with a maximum length of '{maxCharsInBase64}'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/password"); + } + + [Theory] + [InlineData(-1)] + [InlineData(-0.56)] + [InlineData(123.98)] + [InlineData(124)] + public async Task Cannot_use_double_outside_of_valid_range(double age) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Age = age + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be($"The field Age must be between {0.1} exclusive and {122.9} exclusive."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/age"); + } + + [Fact] + public async Task Cannot_use_relative_url() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + BackgroundPicture = new Uri("relativeurl", UriKind.Relative) + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The BackgroundPicture field is not a valid fully-qualified http, https, or ftp URL."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/backgroundPicture"); + } + + [Theory] + [InlineData(0)] + [InlineData(11)] + public async Task Cannot_exceed_collection_length_constraint(int length) + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Tags = Enumerable.Repeat("-", length).ToList() + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field Tags must be a string or collection type with a minimum length of '1' and maximum length of '10'."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/tags"); + } + + [Fact] + public async Task Cannot_use_non_allowed_value() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + CountryCode = "XX" + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The CountryCode field does not equal any of the values specified in AllowedValuesAttribute."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/countryCode"); + } + + [Fact] + public async Task Cannot_use_denied_value() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + Planet = "pluto" + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The Planet field equals one of the values specified in DeniedValuesAttribute."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/planet"); + } + + [Fact] + public async Task Cannot_use_TimeSpan_outside_of_valid_range() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + LastName = newAccount.LastName, + NextRevalidation = TimeSpan.FromSeconds(1).ToString() + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + ErrorResponseDocument response = (await action.Should().ThrowExactlyAsync>()).Which.Result; + response.Errors.Should().HaveCount(1); + + ErrorObject errorObject = response.Errors.First(); + errorObject.Title.Should().Be("Input validation failed."); + errorObject.Detail.Should().Be("The field NextRevalidation must be between 01:00:00 and 05:00:00."); + errorObject.Source.Should().NotBeNull(); + errorObject.Source.Pointer.Should().Be("/data/attributes/nextRevalidation"); + } + + [Fact] + public async Task Can_create_resource_with_valid_properties() + { + // Arrange + SocialMediaAccount newAccount = _fakers.SocialMediaAccount.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + ModelStateValidationClient apiClient = new(httpClient); + + var requestBody = new CreateSocialMediaAccountRequestDocument + { + Data = new DataInCreateSocialMediaAccountRequest + { + Attributes = new AttributesInCreateSocialMediaAccountRequest + { + AlternativeId = newAccount.AlternativeId, + FirstName = newAccount.FirstName, + LastName = newAccount.LastName, + UserName = newAccount.UserName, + CreditCard = newAccount.CreditCard, + Email = newAccount.Email, + Password = Convert.FromBase64String(newAccount.Password!), + Phone = newAccount.Phone, + Age = newAccount.Age, + ProfilePicture = newAccount.ProfilePicture, + BackgroundPicture = new Uri(newAccount.BackgroundPicture!), + Tags = newAccount.Tags, + CountryCode = newAccount.CountryCode, + Planet = newAccount.Planet, + NextRevalidation = newAccount.NextRevalidation!.Value.ToString(), + ValidatedAt = newAccount.ValidatedAt!, + ValidatedAtDate = new DateTimeOffset(newAccount.ValidatedAtDate!.Value.ToDateTime(new TimeOnly()), TimeSpan.Zero), + ValidatedAtTime = newAccount.ValidatedAtTime!.Value.ToTimeSpan() + } + } + }; + + // Act + Func action = () => apiClient.PostSocialMediaAccountAsync(requestBody); + + // Assert + await action.Should().NotThrowAsync(); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs b/test/OpenApiNSwagEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs new file mode 100644 index 0000000000..c0c1d04ffb --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ModelStateValidation/UtcDateTimeJsonConverter.cs @@ -0,0 +1,18 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OpenApiNSwagEndToEndTests.ModelStateValidation; + +internal sealed class UtcDateTimeJsonConverter : JsonConverter +{ + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + DateTimeOffset dateTimeOffset = DateTimeOffset.Parse(reader.GetString()!); + return dateTimeOffset.UtcDateTime; + } + + public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.ToUniversalTime().ToString("O")); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj new file mode 100644 index 0000000000..2fc34289fa --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/OpenApiNSwagEndToEndTests.csproj @@ -0,0 +1,99 @@ + + + + net9.0 + + + + + + + + + + + + + + + + + + + + + + + internal + + + + + ClientIdGenerationModes + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + ModelStateValidation + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + Headers + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + true + + + QueryStrings + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + RestrictedControllers + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + Links + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + AtomicOperations + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + OnlyRelationshipsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + SubsetOfVariousInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + SubsetOfOperationsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + NoOperationsInheritance + $(MSBuildProjectName).%(Name).GeneratedCode + %(Name)Client + %(ClassName).cs + + + diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/FilterTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/FilterTests.cs new file mode 100644 index 0000000000..f663d55180 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/FilterTests.cs @@ -0,0 +1,179 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.QueryStrings; + +public sealed class FilterTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly QueryStringFakers _fakers = new(); + + public FilterTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_filter_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(2); + nodes[0].Name = "John No Quote"; + nodes[1].Name = "Brian O'Quote"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["filter"] = "equals(name,'Brian O''Quote')" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeCollectionAsync(queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(nodes[1].Name); + attributes.Comment.Should().Be(nodes[1].Comment); + }); + + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(1); + } + + [Fact] + public async Task Can_filter_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Comment = "Discount: $10"; + node.Children.ElementAt(1).Comment = "Discount: 5%"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["filter"] = "and(startsWith(comment,'Discount:'),contains(comment,'%'))" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeChildrenAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(node.Children.ElementAt(1).Name); + attributes.Comment.Should().Be(node.Children.ElementAt(1).Comment); + }); + + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(1); + } + + [Fact] + public async Task Can_filter_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Children = _fakers.Node.GenerateSet(1); + node.Children.ElementAt(1).Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["filter"] = "greaterThan(count(children),'1')" + }; + + // Act + NodeIdentifierCollectionResponseDocument response = await apiClient.GetNodeChildrenRelationshipAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(1); + response.Links.Should().NotBeNull(); + response.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); + } + + [Fact] + public async Task Cannot_use_empty_filter() + { + // Arrange + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["filter"] = null + }; + + // Act + Func action = async () => _ = await apiClient.GetNodeAsync(Unknown.StringId.Int64, queryString); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be("HTTP 400: The query string is invalid."); + exception.Result.Links.Should().NotBeNull(); + exception.Result.Links.Describedby.Should().Be("/swagger/v1/swagger.json"); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'filter' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("filter"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs new file mode 100644 index 0000000000..a7383e4fc0 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/IncludeTests.cs @@ -0,0 +1,201 @@ +using FluentAssertions; +using OpenApiNSwagEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.QueryStrings; + +public sealed class IncludeTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly QueryStringFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + testContext.UseController(); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "values.owner" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeCollectionAsync(queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.StringId); + + response.Included.Should().HaveCount(2); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values.ElementAt(1).StringId); + } + + [Fact] + public async Task Can_include_in_primary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(1); + node.Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "children.parent,values" + }; + + // Act + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + + // Assert + response.Data.Id.Should().Be(node.StringId); + + response.Included.Should().HaveCount(3); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(0).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Children.ElementAt(1).StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Values[0].StringId); + } + + [Fact] + public async Task Can_include_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + node.Values = _fakers.NameValuePair.GenerateList(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "owner.parent,owner.values" + }; + + // Act + NameValuePairCollectionResponseDocument response = await apiClient.GetNodeValuesAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(2); + + response.Included.Should().HaveCount(2); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.StringId); + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.StringId); + } + + [Fact] + public async Task Can_include_in_secondary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + node.Parent.Parent = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "parent.parent" + }; + + // Act + NullableSecondaryNodeResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.Parent.StringId); + + response.Included.Should().HaveCount(1); + + response.Included.OfType().Should().ContainSingle(include => include.Id == node.Parent.Parent.StringId).Subject.With(include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.Name.Should().Be(node.Parent.Parent.Name); + }); + } + + [Fact] + public async Task Can_use_empty_include() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = null + }; + + // Act + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + + // Assert + response.Data.Id.Should().Be(node.StringId); + + response.Included.Should().BeEmpty(); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/PaginationTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/PaginationTests.cs new file mode 100644 index 0000000000..a78be7a19f --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/PaginationTests.cs @@ -0,0 +1,188 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.QueryStrings; + +public sealed class PaginationTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly QueryStringFakers _fakers = new(); + + public PaginationTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_paginate_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["page[size]"] = "1", + ["page[number]"] = "2" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeCollectionAsync(queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Can_paginate_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["page[size]"] = "2", + ["page[number]"] = "1" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeChildrenAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Can_paginate_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["page[size]"] = "2", + ["page[number]"] = "2" + }; + + // Act + NodeIdentifierCollectionResponseDocument response = await apiClient.GetNodeChildrenRelationshipAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(2).StringId); + response.Meta.Should().NotBeNull(); + response.Meta.Should().ContainKey("total").WhoseValue.Should().Be(3); + } + + [Fact] + public async Task Cannot_use_empty_page_size() + { + // Arrange + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["page[size]"] = null + }; + + // Act + Func action = async () => _ = await apiClient.GetNodeAsync(Unknown.StringId.Int64, queryString); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be("HTTP 400: The query string is invalid."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'page[size]' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("page[size]"); + } + + [Fact] + public async Task Cannot_use_empty_page_number() + { + // Arrange + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["page[number]"] = null + }; + + // Act + Func action = async () => _ = await apiClient.GetNodeAsync(Unknown.StringId.Int64, queryString); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be("HTTP 400: The query string is invalid."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'page[number]' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("page[number]"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/SortTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/SortTests.cs new file mode 100644 index 0000000000..44a11b217f --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/SortTests.cs @@ -0,0 +1,158 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.QueryStrings; + +public sealed class SortTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly QueryStringFakers _fakers = new(); + + public SortTests(IntegrationTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_sort_in_primary_resources() + { + // Arrange + List nodes = _fakers.Node.GenerateList(2); + nodes[0].Name = "A"; + nodes[1].Name = "B"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.AddRange(nodes); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["sort"] = "-name" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeCollectionAsync(queryString); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(nodes[1].StringId); + response.Data.ElementAt(1).Id.Should().Be(nodes[0].StringId); + } + + [Fact] + public async Task Can_sort_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Name = "B"; + node.Children.ElementAt(1).Name = "A"; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["sort"] = "name" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeChildrenAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(1).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(0).StringId); + } + + [Fact] + public async Task Can_sort_at_ToMany_relationship_endpoint() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(2); + node.Children.ElementAt(0).Children = _fakers.Node.GenerateSet(1); + node.Children.ElementAt(1).Children = _fakers.Node.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["sort"] = "count(children)" + }; + + // Act + NodeIdentifierCollectionResponseDocument response = await apiClient.GetNodeChildrenRelationshipAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + response.Data.ElementAt(1).Id.Should().Be(node.Children.ElementAt(1).StringId); + } + + [Fact] + public async Task Cannot_use_empty_sort() + { + // Arrange + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["sort"] = null + }; + + // Act + Func action = async () => _ = await apiClient.GetNodeAsync(Unknown.StringId.Int64, queryString); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); + exception.Message.Should().Be("HTTP 400: The query string is invalid."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("400"); + error.Title.Should().Be("Missing query string parameter value."); + error.Detail.Should().Be("Missing value for 'sort' query string parameter."); + error.Source.Should().NotBeNull(); + error.Source.Parameter.Should().Be("sort"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs b/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs new file mode 100644 index 0000000000..ccd6e77bcc --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/QueryStrings/SparseFieldSetTests.cs @@ -0,0 +1,205 @@ +using FluentAssertions; +using OpenApiNSwagEndToEndTests.QueryStrings.GeneratedCode; +using OpenApiTests; +using OpenApiTests.QueryStrings; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.QueryStrings; + +public sealed class SparseFieldSetTests : IClassFixture, QueryStringDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, QueryStringDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly QueryStringFakers _fakers = new(); + + public SparseFieldSetTests(IntegrationTestContext, QueryStringDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_select_attribute_in_primary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["fields[nodes]"] = "name" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeCollectionAsync(queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().Be(node.Name); + attributes.Comment.Should().BeNull(); + }); + + response.Data.ElementAt(0).Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_select_fields_in_primary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["fields[nodes]"] = "comment,parent" + }; + + // Act + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + + // Assert + response.Data.Id.Should().Be(node.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().BeNull(); + response.Data.Attributes.Comment.Should().Be(node.Comment); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.Parent.Should().NotBeNull(); + response.Data.Relationships.Children.Should().BeNull(); + } + + [Fact] + public async Task Can_select_fields_in_secondary_resources() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Children = _fakers.Node.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["fields[nodes]"] = "comment,children" + }; + + // Act + NodeCollectionResponseDocument response = await apiClient.GetNodeChildrenAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(node.Children.ElementAt(0).StringId); + + response.Data.ElementAt(0).Attributes.RefShould().NotBeNull().And.Subject.With(attributes => + { + attributes.Name.Should().BeNull(); + attributes.Comment.Should().Be(node.Children.ElementAt(0).Comment); + }); + + response.Data.ElementAt(0).Relationships.RefShould().NotBeNull().And.Subject.With(relationships => + { + relationships.Parent.Should().BeNull(); + relationships.Children.Should().NotBeNull(); + }); + } + + [Fact] + public async Task Can_select_fields_in_secondary_resource() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + node.Parent = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["fields[nodes]"] = "comment,children" + }; + + // Act + NullableSecondaryNodeResponseDocument response = await apiClient.GetNodeParentAsync(node.StringId!, queryString); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(node.Parent.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().BeNull(); + response.Data.Attributes.Comment.Should().Be(node.Parent.Comment); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.Parent.Should().BeNull(); + response.Data.Relationships.Children.Should().NotBeNull(); + } + + [Fact] + public async Task Can_select_empty_fieldset() + { + // Arrange + Node node = _fakers.Node.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Nodes.Add(node); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new QueryStringsClient(httpClient); + + var queryString = new Dictionary + { + ["fields[nodes]"] = null + }; + + // Act + PrimaryNodeResponseDocument response = await apiClient.GetNodeAsync(node.StringId!, queryString); + + // Assert + response.Data.Id.Should().Be(node.StringId); + response.Data.Attributes.Should().BeNull(); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..7f6dcbbaaf --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/NoOperations/ResourceInheritanceTests.cs @@ -0,0 +1,951 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.NoOperationsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.NoOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.NoOperations; + +public sealed class ResourceInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public ResourceInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_abstract_endpoint() + { + // Arrange + Residence residence = _fakers.Residence.GenerateOne(); + Mansion mansion = _fakers.Mansion.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(residence, mansion, familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + BuildingCollectionResponseDocument response = await apiClient.GetBuildingCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(3); + + response.Data.OfType().Should().ContainSingle(data => data.Id == residence.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == mansion.StringId).Subject.With(data => + { + AttributesInMansionResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == familyHome.StringId).Subject.With(data => + { + AttributesInFamilyHomeResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_base_endpoint() + { + // Arrange + Road road = _fakers.Road.GenerateOne(); + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Roads.AddRange(road, cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoadCollectionResponseDocument response = await apiClient.GetRoadCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == road.StringId).Subject.With(data => + { + AttributesInRoadResponse? attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(road.LengthInMeters); + + data.Relationships.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == cyclePath.StringId).Subject.With(data => + { + AttributesInCyclePathResponse attributes = data.Attributes.Should().BeOfType().Subject; + + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + + data.Relationships.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resources_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome1 = _fakers.FamilyHome.GenerateOne(); + FamilyHome familyHome2 = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.Buildings.AddRange(familyHome1, familyHome2); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + FamilyHomeCollectionResponseDocument response = await apiClient.GetFamilyHomeCollectionAsync(); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.Should().ContainSingle(data => data.Id == familyHome1.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome1.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome1.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + + response.Data.Should().ContainSingle(data => data.Id == familyHome2.StringId).Subject.With(data => + { + AttributesInResidenceResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome2.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome2.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_abstract_endpoint() + { + // Arrange + Mansion mansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryBuildingResponseDocument response = await apiClient.GetBuildingAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(mansion.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + + relationships.Staff.Should().NotBeNull(); + relationships.Staff.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_base_endpoint() + { + // Arrange + CyclePath cyclePath = _fakers.CyclePath.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(cyclePath); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryRoadResponseDocument response = await apiClient.GetRoadAsync(cyclePath.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(cyclePath.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + ((decimal?)attributes.LengthInMeters).Should().BeApproximately(cyclePath.LengthInMeters); + attributes.HasLaneForPedestrians.Should().Be(cyclePath.HasLaneForPedestrians); + }); + + response.Data.Relationships.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_at_concrete_derived_endpoint() + { + // Arrange + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Buildings.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + PrimaryFamilyHomeResponseDocument response = await apiClient.GetFamilyHomeAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(familyHome.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + SecondaryResidenceResponseDocument response = await apiClient.GetRoomResidenceAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resource_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + bedroom.Residence = familyHome; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + SecondaryResidenceResponseDocument response = await apiClient.GetBedroomResidenceAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + + response.Data.Attributes.Should().BeOfType().Subject.With(attributes => + { + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + }); + + response.Data.Relationships.Should().BeOfType().Subject.With(relationships => + { + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoomCollectionResponseDocument response = await apiClient.GetResidenceRoomsAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId).Subject.With(data => + { + AttributesInKitchenResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(kitchen.SurfaceInSquareMeters); + attributes.HasPantry.Should().Be(kitchen.HasPantry); + + RelationshipsInKitchenResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId).Subject.With(data => + { + AttributesInBedroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bedroom.SurfaceInSquareMeters); + attributes.BedCount.Should().Be(bedroom.BedCount); + + RelationshipsInBedroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_get_secondary_resources_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + RoomCollectionResponseDocument response = await apiClient.GetMansionRoomsAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId).Subject.With(data => + { + AttributesInBathroomResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(bathroom.SurfaceInSquareMeters); + attributes.HasBath.Should().Be(bathroom.HasBath); + + RelationshipsInBathroomResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId).Subject.With(data => + { + AttributesInToiletResponse attributes = data.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(toilet.SurfaceInSquareMeters); + attributes.HasSink.Should().Be(toilet.HasSink); + + RelationshipsInToiletResponse relationships = data.Relationships.Should().BeOfType().Subject; + + relationships.Residence.Should().NotBeNull(); + relationships.Residence.Data.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_create_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateRoadRequestDocument requestBody = new() + { + Data = new DataInCreateRoadRequest + { + Attributes = new AttributesInCreateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostRoadAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + long newRoadId = long.Parse(roadData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(newRoadId); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateBuildingRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInCreateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom1.StringId! + }, + new BedroomIdentifierInRequest + { + Id = existingBedroom2.StringId! + }, + new LivingRoomIdentifierInRequest + { + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "rooms" + }; + + // Act + PrimaryBuildingResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostBuildingAsync(requestBody, queryString)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_create_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + CreateResidenceRequestDocument requestBody = new() + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryResidenceResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + long newFamilyHomeId = long.Parse(familyHomeData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_concrete_base_resource_at_abstract_endpoint() + { + // Arrange + Road existingRoad = _fakers.Road.GenerateOne(); + + double newLengthInMeters = (double)_fakers.Road.GenerateOne().LengthInMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Roads.Add(existingRoad); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateRoadRequestDocument requestBody = new() + { + Data = new DataInUpdateRoadRequest + { + Id = existingRoad.StringId!, + Attributes = new AttributesInUpdateRoadRequest + { + LengthInMeters = newLengthInMeters + } + } + }; + + // Act + PrimaryRoadResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoadAsync(existingRoad.StringId!, requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInRoadResponse roadData = response.Data.Should().BeOfType().Subject; + + AttributesInRoadResponse roadAttributes = roadData.Attributes.Should().BeOfType().Subject; + roadAttributes.LengthInMeters.Should().Be(newLengthInMeters); + + roadData.Relationships.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Road roadInDatabase = await dbContext.Roads.FirstWithIdAsync(existingRoad.Id); + + roadInDatabase.LengthInMeters.Should().Be((decimal)newLengthInMeters); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_abstract_endpoint_with_relationships_and_includes() + { + // Arrange + Bedroom existingBedroom1 = _fakers.Bedroom.GenerateOne(); + Bedroom existingBedroom2 = _fakers.Bedroom.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms.Add(existingBedroom1); + existingMansion.Rooms.Add(existingBedroom2); + existingMansion.Rooms.Add(existingLivingRoom); + + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + }, + Relationships = new RelationshipsInUpdateFamilyHomeRequest + { + Rooms = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom1.StringId! + }, + new BedroomIdentifierInRequest + { + Id = existingBedroom2.StringId! + }, + new LivingRoomIdentifierInRequest + { + Id = existingLivingRoom.StringId! + } + ] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "rooms" + }; + + // Act + PrimaryBuildingResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBuildingAsync(existingFamilyHome.StringId!, requestBody, queryString)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + + familyHomeRelationships.Rooms.RefShould().NotBeNull().And.Subject.Data.With(roomData => + { + roomData.Should().HaveCount(3); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom1.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingBedroom2.StringId); + roomData.OfType().Should().ContainSingle(data => data.Id == existingLivingRoom.StringId); + }); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(3); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom1.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom2.Id); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + }); + } + + [Fact] + public async Task Can_update_concrete_derived_resource_at_concrete_base_endpoint() + { + // Arrange + FamilyHome existingFamilyHome = _fakers.FamilyHome.GenerateOne(); + existingFamilyHome.Rooms.Add(_fakers.Kitchen.GenerateOne()); + + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(existingFamilyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + UpdateBuildingRequestDocument requestBody = new() + { + Data = new DataInUpdateFamilyHomeRequest + { + Id = existingFamilyHome.StringId!, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }; + + // Act + PrimaryBuildingResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBuildingAsync(existingFamilyHome.StringId!, requestBody)); + + // Assert + response.Should().NotBeNull(); + + DataInFamilyHomeResponse familyHomeData = response.Data.Should().BeOfType().Subject; + + AttributesInFamilyHomeResponse familyHomeAttributes = familyHomeData.Attributes.Should().BeOfType().Subject; + familyHomeAttributes.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes.FloorCount.Should().Be(newFamilyHome.FloorCount); + + RelationshipsInFamilyHomeResponse familyHomeRelationships = familyHomeData.Relationships.Should().BeOfType().Subject; + familyHomeRelationships.Rooms.Should().NotBeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(existingFamilyHome.Id); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(1); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == existingFamilyHome.Rooms.ElementAt(0).Id); + }); + } + + [Fact] + public async Task Can_delete_concrete_derived_resource_at_abstract_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new NoOperationsInheritanceClient(httpClient); + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteBuildingAsync(existingMansion.StringId!)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + FamilyHome? familyHomeInDatabase = await dbContext.FamilyHomes.FirstWithIdOrDefaultAsync(existingMansion.Id); + + familyHomeInDatabase.Should().BeNull(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs new file mode 100644 index 0000000000..9ad2ff8c41 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/OnlyRelationships/RelationshipInheritanceTests.cs @@ -0,0 +1,896 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.OnlyRelationshipsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.OnlyRelationships; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.OnlyRelationships; + +public sealed class RelationshipInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public RelationshipInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + // GET /rooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_abstract_base_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + ResidenceIdentifierResponseDocument response = await apiClient.GetRoomResidenceRelationshipAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /bedrooms/1/relationships/residence => familyHome + [Fact] + public async Task Can_get_ToOne_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + bedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Rooms.Add(bedroom); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + ResidenceIdentifierResponseDocument response = await apiClient.GetBedroomResidenceRelationshipAsync(bedroom.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().BeOfType(); + response.Data.Id.Should().Be(bedroom.Residence.StringId); + } + + // GET /residences/1/relationships/rooms => [kitchen, bedroom] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_base_endpoint() + { + // Arrange + Kitchen kitchen = _fakers.Kitchen.GenerateOne(); + Bedroom bedroom = _fakers.Bedroom.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(kitchen); + familyHome.Rooms.Add(bedroom); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.FamilyHomes.Add(familyHome); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + RoomIdentifierCollectionResponseDocument response = await apiClient.GetResidenceRoomsRelationshipAsync(familyHome.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == kitchen.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == bedroom.StringId); + } + + // GET /mansions/1/relationships/rooms => [bathroom, toilet] + [Fact] + public async Task Can_get_ToMany_relationship_at_concrete_derived_endpoint() + { + // Arrange + Bathroom bathroom = _fakers.Bathroom.GenerateOne(); + Toilet toilet = _fakers.Toilet.GenerateOne(); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(bathroom); + mansion.Rooms.Add(toilet); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(mansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + // Act + RoomIdentifierCollectionResponseDocument response = await apiClient.GetMansionRoomsRelationshipAsync(mansion.StringId!); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(2); + + response.Data.OfType().Should().ContainSingle(data => data.Id == bathroom.StringId); + response.Data.OfType().Should().ContainSingle(data => data.Id == toilet.StringId); + } + + // PATCH /rooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /rooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_abstract_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchRoomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: residence } + [Fact] + public async Task Can_set_concrete_base_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new ResidenceIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBathroomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /bathrooms/1/relationships/residence { type: mansion } + [Fact] + public async Task Can_set_concrete_derived_resource_at_concrete_derived_ToOne_relationship_endpoint() + { + // Arrange + Bathroom existingBathroom = _fakers.Bathroom.GenerateOne(); + existingBathroom.Residence = _fakers.FamilyHome.GenerateOne(); + + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Bathrooms.Add(existingBathroom); + dbContext.Mansions.Add(existingMansion); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Id = existingMansion.StringId + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchBathroomResidenceRelationshipAsync(existingBathroom.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Room roomInDatabase = await dbContext.Rooms.Include(room => room.Residence).FirstWithIdAsync(existingBathroom.Id); + + roomInDatabase.Should().BeOfType(); + + roomInDatabase.Residence.Should().BeOfType(); + roomInDatabase.Residence.Id.Should().Be(existingMansion.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_set_abstract_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // PATCH /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_set_concrete_derived_resources_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PatchMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(1); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_add_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // POST /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_add_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + LivingRoom existingLivingRoom = _fakers.LivingRoom.GenerateOne(); + existingMansion.Rooms.Add(existingLivingRoom); + + Bedroom existingBedroom = _fakers.Bedroom.GenerateOne(); + existingBedroom.Residence = _fakers.FamilyHome.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + dbContext.Bedrooms.Add(existingBedroom); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingBedroom.StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().HaveCount(2); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(livingRoom => livingRoom.Id == existingLivingRoom.Id); + residenceInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == existingBedroom.Id); + }); + } + + // DELETE /residences/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /residences/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_base_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteResidenceRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: room } + [Fact] + public async Task Can_remove_abstract_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.LivingRoom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new RoomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + // DELETE /mansions/1/relationships/rooms { type: bedroom } + [Fact] + public async Task Can_remove_concrete_derived_resource_at_concrete_derived_ToMany_relationship_endpoint() + { + // Arrange + Mansion existingMansion = _fakers.Mansion.GenerateOne(); + existingMansion.Rooms = _fakers.Bedroom.GenerateSet(1); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Mansions.Add(existingMansion); + + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new OnlyRelationshipsInheritanceClient(httpClient); + + var requestBody = new ToManyRoomInRequest + { + Data = + [ + new BedroomIdentifierInRequest + { + Id = existingMansion.Rooms.ElementAt(0).StringId + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.DeleteMansionRoomsRelationshipAsync(existingMansion.StringId!, requestBody)); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Residence residenceInDatabase = await dbContext.Residences.Include(residence => residence.Rooms).FirstWithIdAsync(existingMansion.Id); + + residenceInDatabase.Should().BeOfType(); + + residenceInDatabase.Rooms.Should().BeEmpty(); + }); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs new file mode 100644 index 0000000000..617241854b --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfOperations/OperationsInheritanceTests.cs @@ -0,0 +1,326 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.SubsetOfOperationsInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfOperations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.SubsetOfOperations; + +public sealed class OperationsInheritanceTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public OperationsInheritanceTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(true); + + testContext.ConfigureServices(services => + { + services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)); + + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_use_inheritance_at_operations_endpoint() + { + // Arrange + StaffMember existingStaffMember = _fakers.StaffMember.GenerateOne(); + + Mansion newMansion = _fakers.Mansion.GenerateOne(); + Kitchen newKitchen = _fakers.Kitchen.GenerateOne(); + FamilyHome newFamilyHome = _fakers.FamilyHome.GenerateOne(); + Bedroom newBedroom = _fakers.Bedroom.GenerateOne(); + int? newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.StaffMembers.Add(existingStaffMember); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfOperationsInheritanceClient(httpClient); + + const string mansionLid = "mansion-lid"; + const string kitchenLid = "kitchen-lid"; + const string familyHomeLid = "family-home-lid"; + const string bedroomLid = "bedroom-lid"; + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + // NOTE: CreateBuildingOperation is not generated, because it is turned off. + new CreateResidenceOperation + { + Data = new DataInCreateMansionRequest + { + Lid = mansionLid, + Attributes = new AttributesInCreateMansionRequest + { + SurfaceInSquareMeters = newMansion.SurfaceInSquareMeters!.Value, + NumberOfResidents = newMansion.NumberOfResidents!.Value, + OwnerName = newMansion.OwnerName + }, + Relationships = new RelationshipsInCreateMansionRequest + { + Staff = new ToManyStaffMemberInRequest + { + Data = + [ + new StaffMemberIdentifierInRequest + { + Id = existingStaffMember.StringId + } + ] + } + } + } + }, + // NOTE: It is possible to create an operation for abstract type. + new CreateRoomOperation + { + // NOTE: DataInCreateRoomRequest is generated, but as abstract type. + Data = new DataInCreateKitchenRequest + { + Lid = kitchenLid, + Attributes = new AttributesInCreateKitchenRequest + { + SurfaceInSquareMeters = newKitchen.SurfaceInSquareMeters!.Value, + HasPantry = newKitchen.HasPantry!.Value + }, + Relationships = new RelationshipsInCreateKitchenRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new MansionIdentifierInRequest + { + Lid = mansionLid + } + } + } + } + }, + new CreateFamilyHomeOperation + { + Data = new DataInCreateFamilyHomeRequest + { + Lid = familyHomeLid, + Attributes = new AttributesInCreateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHome.SurfaceInSquareMeters!.Value, + NumberOfResidents = newFamilyHome.NumberOfResidents!.Value, + FloorCount = newFamilyHome.FloorCount + } + } + }, + new CreateBedroomOperation + { + Data = new DataInCreateBedroomRequest + { + Lid = bedroomLid, + Attributes = new AttributesInCreateBedroomRequest + { + SurfaceInSquareMeters = newBedroom.SurfaceInSquareMeters!.Value, + BedCount = newBedroom.BedCount!.Value + }, + Relationships = new RelationshipsInCreateBedroomRequest + { + Residence = new ToOneResidenceInRequest + { + Data = new FamilyHomeIdentifierInRequest + { + Lid = familyHomeLid + } + } + } + } + }, + new AddToFamilyHomeRoomsRelationshipOperation + { + Ref = new FamilyHomeRoomsRelationshipIdentifier + { + Lid = familyHomeLid + }, + Data = + [ + new KitchenIdentifierInRequest + { + Lid = kitchenLid + } + ] + }, + new UpdateResidenceOperation + { + // NOTE: Can use Ref to base type, while Data is derived. + Ref = new ResidenceIdentifierInRequest + { + Lid = familyHomeLid + }, + Data = new DataInUpdateFamilyHomeRequest + { + Lid = familyHomeLid, + Attributes = new AttributesInUpdateFamilyHomeRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + }, + new RemoveFromMansionStaffRelationshipOperation + { + Ref = new MansionStaffRelationshipIdentifier + { + Lid = mansionLid + }, + Data = [] + } + ] + }; + + // Act + OperationsResponseDocument? response = await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + response.Should().NotBeNull(); + response.Atomic_results.Should().HaveCount(7); + + DataInMansionResponse mansionData = response.Atomic_results.ElementAt(0).Data.Should().BeOfType().Subject; + AttributesInMansionResponse mansionAttributes = mansionData.Attributes.Should().BeOfType().Subject; + mansionAttributes.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionAttributes.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionAttributes.OwnerName.Should().Be(newMansion.OwnerName); + mansionData.Relationships.Should().BeNull(); + + DataInKitchenResponse kitchenData = response.Atomic_results.ElementAt(1).Data.Should().BeOfType().Subject; + AttributesInKitchenResponse kitchenAttributes = kitchenData.Attributes.Should().BeOfType().Subject; + kitchenAttributes.SurfaceInSquareMeters.Should().Be(newKitchen.SurfaceInSquareMeters); + kitchenAttributes.HasPantry.Should().Be(newKitchen.HasPantry); + kitchenData.Relationships.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData2 = response.Atomic_results.ElementAt(2).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes2 = familyHomeData2.Attributes.Should().BeOfType().Subject; + familyHomeAttributes2.SurfaceInSquareMeters.Should().Be(newFamilyHome.SurfaceInSquareMeters); + familyHomeAttributes2.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes2.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData2.Relationships.Should().BeNull(); + + DataInBedroomResponse bedroomData = response.Atomic_results.ElementAt(3).Data.Should().BeOfType().Subject; + AttributesInBedroomResponse bedroomAttributes = bedroomData.Attributes.Should().BeOfType().Subject; + bedroomAttributes.SurfaceInSquareMeters.Should().Be(newBedroom.SurfaceInSquareMeters); + bedroomAttributes.BedCount.Should().Be(newBedroom.BedCount); + bedroomData.Relationships.Should().BeNull(); + + response.Atomic_results.ElementAt(4).Data.Should().BeNull(); + + DataInFamilyHomeResponse familyHomeData5 = response.Atomic_results.ElementAt(5).Data.Should().BeOfType().Subject; + AttributesInFamilyHomeResponse familyHomeAttributes5 = familyHomeData5.Attributes.Should().BeOfType().Subject; + familyHomeAttributes5.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeAttributes5.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeAttributes5.FloorCount.Should().Be(newFamilyHome.FloorCount); + familyHomeData5.Relationships.Should().BeNull(); + + response.Atomic_results.ElementAt(6).Data.Should().BeNull(); + + long newMansionId = long.Parse(mansionData.Id.Should().NotBeNull().And.Subject); + long newKitchenId = long.Parse(kitchenData.Id.Should().NotBeNull().And.Subject); + long newFamilyHomeId = long.Parse(familyHomeData2.Id.Should().NotBeNull().And.Subject); + long newBedroomId = long.Parse(bedroomData.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + Mansion mansionInDatabase = + await dbContext.Mansions.Include(mansion => mansion.Rooms).Include(mansion => mansion.Staff).FirstWithIdAsync(newMansionId); + + mansionInDatabase.SurfaceInSquareMeters.Should().Be(newMansion.SurfaceInSquareMeters); + mansionInDatabase.NumberOfResidents.Should().Be(newMansion.NumberOfResidents); + mansionInDatabase.OwnerName.Should().Be(newMansion.OwnerName); + + mansionInDatabase.Rooms.Should().BeEmpty(); + mansionInDatabase.Staff.Should().HaveCount(1); + mansionInDatabase.Staff.ElementAt(0).Id.Should().Be(existingStaffMember.Id); + + FamilyHome familyHomeInDatabase = await dbContext.FamilyHomes.Include(familyHome => familyHome.Rooms).FirstWithIdAsync(newFamilyHomeId); + + familyHomeInDatabase.SurfaceInSquareMeters.Should().Be(newFamilyHomeSurfaceInSquareMeters); + familyHomeInDatabase.NumberOfResidents.Should().Be(newFamilyHome.NumberOfResidents); + familyHomeInDatabase.FloorCount.Should().Be(newFamilyHome.FloorCount); + + familyHomeInDatabase.Rooms.Should().HaveCount(2); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(kitchen => kitchen.Id == newKitchenId); + familyHomeInDatabase.Rooms.OfType().Should().ContainSingle(bedroom => bedroom.Id == newBedroomId); + }); + } + + [Fact] + public async Task Cannot_use_base_attributes_type_in_derived_data() + { + // Arrange + int newFamilyHomeSurfaceInSquareMeters = _fakers.FamilyHome.GenerateOne().SurfaceInSquareMeters!.Value; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfOperationsInheritanceClient(httpClient); + + OperationsRequestDocument requestBody = new() + { + Atomic_operations = + [ + new CreateResidenceOperation + { + Data = new DataInCreateFamilyHomeRequest + { + Attributes = new AttributesInCreateResidenceRequest + { + SurfaceInSquareMeters = newFamilyHomeSurfaceInSquareMeters + } + } + } + ] + }; + + // Act + Func action = async () => await ApiResponse.TranslateAsync(async () => await apiClient.PostOperationsAsync(requestBody)); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.Conflict); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("409"); + error.Title.Should().Be("Incompatible resource type found."); + error.Detail.Should().Be("Expected openapi:discriminator with value 'familyHomes' instead of 'residences'."); + error.Source.Should().NotBeNull(); + error.Source.Pointer.Should().Be("/atomic:operations[0]/data/attributes/openapi:discriminator"); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs new file mode 100644 index 0000000000..5f853fd50a --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/ResourceInheritance/SubsetOfVarious/IncludeTests.cs @@ -0,0 +1,149 @@ +using FluentAssertions; +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.SubsetOfVariousInheritance.GeneratedCode; +using OpenApiTests; +using OpenApiTests.ResourceInheritance; +using OpenApiTests.ResourceInheritance.Models; +using OpenApiTests.ResourceInheritance.SubsetOfVarious; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.ResourceInheritance.SubsetOfVarious; + +public sealed class IncludeTests + : IClassFixture, ResourceInheritanceDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, ResourceInheritanceDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly ResourceInheritanceFakers _fakers = new(); + + public IncludeTests(IntegrationTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseInheritanceControllers(false); + + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Fact] + public async Task Can_include_in_primary_resources() + { + // Arrange + District district = _fakers.District.GenerateOne(); + + FamilyHome familyHome = _fakers.FamilyHome.GenerateOne(); + familyHome.Rooms.Add(_fakers.LivingRoom.GenerateOne()); + familyHome.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(familyHome); + + Mansion mansion = _fakers.Mansion.GenerateOne(); + mansion.Rooms.Add(_fakers.Kitchen.GenerateOne()); + mansion.Rooms.Add(_fakers.Bathroom.GenerateOne()); + mansion.Rooms.Add(_fakers.Toilet.GenerateOne()); + district.Buildings.Add(mansion); + + Residence residence = _fakers.Residence.GenerateOne(); + residence.Rooms.Add(_fakers.Bedroom.GenerateOne()); + district.Buildings.Add(residence); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.Districts.Add(district); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new SubsetOfVariousInheritanceClient(httpClient); + + var queryString = new Dictionary + { + ["include"] = "buildings.rooms" + }; + + // Act + DistrictCollectionResponseDocument response = await apiClient.GetDistrictCollectionAsync(queryString); + + // Assert + response.Should().NotBeNull(); + response.Data.Should().HaveCount(1); + response.Data.ElementAt(0).Id.Should().Be(district.StringId); + + response.Included.Should().HaveCount(9); + + string familyHomeLivingRoomId = familyHome.Rooms.OfType().Single().StringId!; + string familyRoomBedroomId = familyHome.Rooms.OfType().Single().StringId!; + string mansionKitchenId = mansion.Rooms.OfType().Single().StringId!; + string mansionBathroomId = mansion.Rooms.OfType().Single().StringId!; + string mansionToiletId = mansion.Rooms.OfType().Single().StringId!; + string residenceBedroomId = residence.Rooms.OfType().Single().StringId!; + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHome.StringId).Subject.With(include => + { + AttributesInFamilyHomeResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(familyHome.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(familyHome.NumberOfResidents); + attributes.FloorCount.Should().Be(familyHome.FloorCount); + + RelationshipsInFamilyHomeResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(2); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyHomeLivingRoomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == familyRoomBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == mansion.StringId).Subject.With(include => + { + AttributesInMansionResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(mansion.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(mansion.NumberOfResidents); + attributes.OwnerName.Should().Be(mansion.OwnerName); + + RelationshipsInMansionResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(3); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionKitchenId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionBathroomId); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == mansionToiletId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == residence.StringId).Subject.With(include => + { + AttributesInResidenceResponse attributes = include.Attributes.Should().BeOfType().Subject; + + attributes.SurfaceInSquareMeters.Should().Be(residence.SurfaceInSquareMeters); + attributes.NumberOfResidents.Should().Be(residence.NumberOfResidents); + + RelationshipsInResidenceResponse relationships = include.Relationships.Should().BeOfType().Subject; + + relationships.Rooms.Should().NotBeNull(); + relationships.Rooms.Data.Should().HaveCount(1); + relationships.Rooms.Data.OfType().Should().ContainSingle(data => data.Id == residenceBedroomId); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == familyHomeLivingRoomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == familyRoomBedroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionKitchenId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionBathroomId); + response.Included.OfType().Should().ContainSingle(include => include.Id == mansionToiletId); + response.Included.OfType().Should().ContainSingle(include => include.Id == residenceBedroomId); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs new file mode 100644 index 0000000000..0fa4bec354 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/CreateResourceTests.cs @@ -0,0 +1,214 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class CreateResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public CreateResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_create_resource_with_includes_and_fieldsets() + { + // Arrange + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + WriteOnlyChannel newChannel = _fakers.WriteOnlyChannel.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.DataStreams.AddRange(existingVideoStream, existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new CreateWriteOnlyChannelRequestDocument + { + Data = new DataInCreateWriteOnlyChannelRequest + { + Attributes = new AttributesInCreateWriteOnlyChannelRequest + { + Name = newChannel.Name, + IsAdultOnly = newChannel.IsAdultOnly + }, + Relationships = new RelationshipsInCreateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Id = existingVideoStream.StringId! + } + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = existingAudioStream.StringId! + } + ] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "videoStream,audioStreams", + ["fields[writeOnlyChannels]"] = "name,isCommercial,videoStream,audioStreams", + ["fields[dataStreams]"] = "bytesTransmitted" + }; + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PostWriteOnlyChannelAsync(requestBody, queryString)); + + response.Should().NotBeNull(); + + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(newChannel.Name); + response.Data.Attributes.IsCommercial.Should().BeNull(); + response.Data.Attributes.IsAdultOnly.Should().BeNull(); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Id.Should().Be(existingVideoStream.StringId); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().HaveCount(1); + response.Data.Relationships.AudioStreams.Data.ElementAt(0).Id.Should().Be(existingAudioStream.StringId); + + response.Included.Should().HaveCount(2); + + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId).Subject.With( + include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingVideoStream.BytesTransmitted); + }); + + response.Included.OfType().Should().ContainSingle(include => include.Id == existingAudioStream.StringId).Subject.With( + include => + { + include.Attributes.Should().NotBeNull(); + include.Attributes.BytesTransmitted.Should().Be((long?)existingAudioStream.BytesTransmitted); + }); + + long newChannelId = long.Parse(response.Data.Id.Should().NotBeNull().And.Subject); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(newChannelId); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(newChannel.Name); + channelInDatabase.IsCommercial.Should().BeNull(); + channelInDatabase.IsAdultOnly.Should().Be(newChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingVideoStream.Id); + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingAudioStream.Id); + }); + } + + [Fact] + public async Task Cannot_create_resource_for_missing_request_body() + { + // Arrange + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + CreateWriteOnlyChannelRequestDocument requestBody = null!; + + // Act + Func action = async () => _ = await apiClient.PostWriteOnlyChannelAsync(requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_create_resource_with_unknown_relationship_ID() + { + // Arrange + WriteOnlyChannel newChannel = _fakers.WriteOnlyChannel.GenerateOne(); + + string unknownVideoStreamId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new CreateWriteOnlyChannelRequestDocument + { + Data = new DataInCreateWriteOnlyChannelRequest + { + Attributes = new AttributesInCreateWriteOnlyChannelRequest + { + Name = newChannel.Name + }, + Relationships = new RelationshipsInCreateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Id = unknownVideoStreamId + } + } + } + } + }; + + // Act + Func action = async () => _ = await apiClient.PostWriteOnlyChannelAsync(requestBody); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: A related resource does not exist."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("A related resource does not exist."); + error.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownVideoStreamId}' in relationship 'videoStream' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/DeleteResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/DeleteResourceTests.cs new file mode 100644 index 0000000000..220f9a009b --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/DeleteResourceTests.cs @@ -0,0 +1,84 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class DeleteResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public DeleteResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_delete_existing_resource() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + await apiClient.DeleteWriteOnlyChannelAsync(existingChannel.StringId!); + + // Assert + await _testContext.RunOnDatabaseAsync(async dbContext => + { + WriteOnlyChannel? channelInDatabase = await dbContext.WriteOnlyChannels.FirstWithIdOrDefaultAsync(existingChannel.Id); + + channelInDatabase.Should().BeNull(); + }); + } + + [Fact] + public async Task Cannot_delete_unknown_resource() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + Func action = async () => await apiClient.DeleteWriteOnlyChannelAsync(unknownChannelId); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The writeOnlyChannel does not exist."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'writeOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs new file mode 100644 index 0000000000..e9c3b3198a --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchRelationshipTests.cs @@ -0,0 +1,153 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class FetchRelationshipTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public FetchRelationshipTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_get_ToOne_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + DataStreamIdentifierResponseDocument response = await apiClient.GetReadOnlyChannelVideoStreamRelationshipAsync(channel.StringId!); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.VideoStream.StringId); + } + + [Fact] + public async Task Can_get_empty_ToOne_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + NullableDataStreamIdentifierResponseDocument response = + await apiClient.GetReadOnlyChannelUltraHighDefinitionVideoStreamRelationshipAsync(channel.StringId!); + + // Assert + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_ToMany_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + channel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + DataStreamIdentifierCollectionResponseDocument response = await apiClient.GetReadOnlyChannelAudioStreamsRelationshipAsync(channel.StringId!); + + // Assert + response.Data.Should().HaveCount(2); + response.Data.Should().ContainSingle(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + response.Data.Should().ContainSingle(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + } + + [Fact] + public async Task Can_get_empty_ToMany_relationship() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + DataStreamIdentifierCollectionResponseDocument response = await apiClient.GetReadOnlyChannelAudioStreamsRelationshipAsync(channel.StringId!); + + // Assert + response.Data.Should().HaveCount(0); + } + + [Fact] + public async Task Cannot_get_relationship_for_unknown_primary_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + Func action = async () => _ = await apiClient.GetReadOnlyChannelVideoStreamRelationshipAsync(unknownChannelId); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The readOnlyChannel does not exist."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs new file mode 100644 index 0000000000..3dfbeaa9cb --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/FetchResourceTests.cs @@ -0,0 +1,269 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class FetchResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public FetchResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_get_primary_resources() + { + // Arrange + List channels = _fakers.ReadOnlyChannel.GenerateList(2); + channels.ForEach(channel => channel.VideoStream = _fakers.DataStream.GenerateOne()); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + await dbContext.ClearTableAsync(); + dbContext.ReadOnlyChannels.AddRange(channels); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + ReadOnlyChannelCollectionResponseDocument response = await apiClient.GetReadOnlyChannelCollectionAsync(); + + // Assert + response.Data.Should().HaveCount(2); + + DataInReadOnlyChannelResponse channel1 = response.Data.Single(channel => channel.Id == channels.ElementAt(0).StringId); + channel1.Attributes.Should().NotBeNull(); + channel1.Attributes.Name.Should().Be(channels[0].Name); + channel1.Attributes.IsCommercial.Should().Be(channels[0].IsCommercial); + channel1.Attributes.IsAdultOnly.Should().Be(channels[0].IsAdultOnly); + channel1.Relationships.Should().NotBeNull(); + channel1.Relationships.VideoStream.Should().NotBeNull(); + channel1.Relationships.VideoStream.Data.Should().BeNull(); + channel1.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channel1.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + channel1.Relationships.AudioStreams.Should().NotBeNull(); + channel1.Relationships.AudioStreams.Data.Should().BeNull(); + + DataInReadOnlyChannelResponse channel2 = response.Data.Single(channel => channel.Id == channels.ElementAt(1).StringId); + channel2.Attributes.Should().NotBeNull(); + channel2.Attributes.Name.Should().Be(channels[1].Name); + channel2.Attributes.IsCommercial.Should().Be(channels[1].IsCommercial); + channel2.Attributes.IsAdultOnly.Should().Be(channels[1].IsAdultOnly); + channel2.Relationships.Should().NotBeNull(); + channel2.Relationships.VideoStream.Should().NotBeNull(); + channel2.Relationships.VideoStream.Data.Should().BeNull(); + channel2.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channel2.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + channel2.Relationships.AudioStreams.Should().NotBeNull(); + channel2.Relationships.AudioStreams.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_primary_resource_by_ID() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + PrimaryReadOnlyChannelResponseDocument response = await apiClient.GetReadOnlyChannelAsync(channel.StringId!); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(channel.Name); + response.Data.Attributes.IsCommercial.Should().Be(channel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().Be(channel.IsAdultOnly); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().BeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeNull(); + } + + [Fact] + public async Task Cannot_get_primary_resource_for_unknown_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + Func action = async () => _ = await apiClient.GetReadOnlyChannelAsync(unknownChannelId); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The readOnlyChannel does not exist."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + [Fact] + public async Task Can_get_secondary_ToOne_resource() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + SecondaryDataStreamResponseDocument response = await apiClient.GetReadOnlyChannelVideoStreamAsync(channel.StringId!); + + // Assert + response.Data.Should().NotBeNull(); + response.Data.Id.Should().Be(channel.VideoStream.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.BytesTransmitted.Should().Be((long?)channel.VideoStream.BytesTransmitted); + } + + [Fact] + public async Task Can_get_unknown_secondary_ToOne_resource() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + NullableSecondaryDataStreamResponseDocument response = await apiClient.GetReadOnlyChannelUltraHighDefinitionVideoStreamAsync(channel.StringId!); + + // Assert + response.Data.Should().BeNull(); + } + + [Fact] + public async Task Can_get_secondary_ToMany_resources() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + channel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + DataStreamCollectionResponseDocument response = await apiClient.GetReadOnlyChannelAudioStreamsAsync(channel.StringId!); + + // Assert + response.Data.Should().HaveCount(2); + + DataInDataStreamResponse audioStream1 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(0).StringId); + audioStream1.Attributes.Should().NotBeNull(); + audioStream1.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(0).BytesTransmitted); + + DataInDataStreamResponse audioStream2 = response.Data.Single(autoStream => autoStream.Id == channel.AudioStreams.ElementAt(1).StringId); + audioStream2.Attributes.Should().NotBeNull(); + audioStream2.Attributes.BytesTransmitted.Should().Be((long?)channel.AudioStreams.ElementAt(1).BytesTransmitted); + } + + [Fact] + public async Task Can_get_no_secondary_ToMany_resources() + { + // Arrange + ReadOnlyChannel channel = _fakers.ReadOnlyChannel.GenerateOne(); + channel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.ReadOnlyChannels.Add(channel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + DataStreamCollectionResponseDocument response = await apiClient.GetReadOnlyChannelAudioStreamsAsync(channel.StringId!); + + // Assert + response.Data.Should().HaveCount(0); + } + + [Fact] + public async Task Cannot_get_secondary_resource_for_unknown_primary_ID() + { + // Arrange + string unknownChannelId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + // Act + Func action = async () => _ = await apiClient.GetReadOnlyChannelVideoStreamAsync(unknownChannelId); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The readOnlyChannel does not exist."); + exception.Result.Errors.Should().HaveCount(1); + + ErrorObject error = exception.Result.Errors.ElementAt(0); + error.Status.Should().Be("404"); + error.Title.Should().Be("The requested resource does not exist."); + error.Detail.Should().Be($"Resource of type 'readOnlyChannels' with ID '{unknownChannelId}' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs new file mode 100644 index 0000000000..60d20f3281 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateRelationshipTests.cs @@ -0,0 +1,403 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using Microsoft.EntityFrameworkCore; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class UpdateRelationshipTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public UpdateRelationshipTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + } + + [Fact] + public async Task Can_replace_ToOne_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingVideoStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new NullableToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Id = existingVideoStream.StringId! + } + }; + + // Act + await ApiResponse.TranslateAsync(async () => + await apiClient.PatchWriteOnlyChannelUltraHighDefinitionVideoStreamRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.UltraHighDefinitionVideoStream) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channelInDatabase.UltraHighDefinitionVideoStream.Id.Should().Be(existingVideoStream.Id); + }); + } + + [Fact] + public async Task Can_clear_ToOne_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new NullableToOneDataStreamInRequest + { + Data = null + }; + + // Act + await ApiResponse.TranslateAsync(async () => + await apiClient.PatchWriteOnlyChannelUltraHighDefinitionVideoStreamRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.UltraHighDefinitionVideoStream) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.UltraHighDefinitionVideoStream.Should().BeNull(); + }); + } + + [Fact] + public async Task Can_replace_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = existingAudioStream.StringId! + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => + await apiClient.PatchWriteOnlyChannelAudioStreamsRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingAudioStream.Id); + }); + } + + [Fact] + public async Task Can_clear_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new ToManyDataStreamInRequest + { + Data = [] + }; + + // Act + await ApiResponse.TranslateAsync(async () => + await apiClient.PatchWriteOnlyChannelAudioStreamsRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_add_to_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(1); + + DataStream existingAudioStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingAudioStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = existingAudioStream.StringId! + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => await apiClient.PostWriteOnlyChannelAudioStreamsRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(2); + channelInDatabase.AudioStreams.Should().ContainSingle(stream => stream.Id == existingChannel.AudioStreams.ElementAt(0).Id); + channelInDatabase.AudioStreams.Should().ContainSingle(stream => stream.Id == existingAudioStream.Id); + }); + } + + [Fact] + public async Task Can_remove_from_ToMany_relationship() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(3); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = existingChannel.AudioStreams.ElementAt(0).StringId! + }, + new DataStreamIdentifierInRequest + { + Id = existingChannel.AudioStreams.ElementAt(1).StringId! + } + ] + }; + + // Act + await ApiResponse.TranslateAsync(async () => + await apiClient.DeleteWriteOnlyChannelAudioStreamsRelationshipAsync(existingChannel.StringId!, requestBody)); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.AudioStreams.Should().HaveCount(1); + channelInDatabase.AudioStreams.ElementAt(0).Id.Should().Be(existingChannel.AudioStreams.ElementAt(2).Id); + }); + } + + [Fact] + public async Task Cannot_update_relationship_for_missing_request_body() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + NullableToOneDataStreamInRequest requestBody = null!; + + // Act + Func action = async () => + await apiClient.PatchWriteOnlyChannelUltraHighDefinitionVideoStreamRelationshipAsync(existingChannel.StringId!, requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_update_relationship_with_unknown_relationship_IDs() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + string unknownAudioStreamId1 = Unknown.StringId.For(); + string unknownAudioStreamId2 = Unknown.StringId.AltFor(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = unknownAudioStreamId1 + }, + new DataStreamIdentifierInRequest + { + Id = unknownAudioStreamId2 + } + ] + }; + + // Act + Func action = async () => await apiClient.PatchWriteOnlyChannelAudioStreamsRelationshipAsync(existingChannel.StringId!, requestBody); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The writeOnlyChannel or a related resource does not exist."); + exception.Result.Errors.Should().HaveCount(2); + + ErrorObject error1 = exception.Result.Errors.ElementAt(0); + error1.Status.Should().Be("404"); + error1.Title.Should().Be("A related resource does not exist."); + error1.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownAudioStreamId1}' in relationship 'audioStreams' does not exist."); + + ErrorObject error2 = exception.Result.Errors.ElementAt(1); + error2.Status.Should().Be("404"); + error2.Title.Should().Be("A related resource does not exist."); + error2.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownAudioStreamId2}' in relationship 'audioStreams' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs new file mode 100644 index 0000000000..526f581898 --- /dev/null +++ b/test/OpenApiNSwagEndToEndTests/RestrictedControllers/UpdateResourceTests.cs @@ -0,0 +1,311 @@ +using System.Net; +using FluentAssertions; +using JsonApiDotNetCore.OpenApi.Client.NSwag; +using JsonApiDotNetCore.Resources; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using OpenApiNSwagEndToEndTests.RestrictedControllers.GeneratedCode; +using OpenApiTests; +using OpenApiTests.RestrictedControllers; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiNSwagEndToEndTests.RestrictedControllers; + +public sealed class UpdateResourceTests : IClassFixture, RestrictionDbContext>>, IDisposable +{ + private readonly IntegrationTestContext, RestrictionDbContext> _testContext; + private readonly XUnitLogHttpMessageHandler _logHttpMessageHandler; + private readonly RestrictionFakers _fakers = new(); + + public UpdateResourceTests(IntegrationTestContext, RestrictionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + _logHttpMessageHandler = new XUnitLogHttpMessageHandler(testOutputHelper); + + testContext.UseController(); + + testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>))); + } + + [Fact] + public async Task Can_update_resource_with_includes_and_fieldsets() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + DataStream existingVideoStream = _fakers.DataStream.GenerateOne(); + string? newChannelName = _fakers.WriteOnlyChannel.GenerateOne().Name; + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + dbContext.DataStreams.Add(existingVideoStream); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Id = existingChannel.StringId!, + Attributes = new AttributesInUpdateWriteOnlyChannelRequest + { + Name = newChannelName + }, + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Id = existingVideoStream.StringId! + } + }, + UltraHighDefinitionVideoStream = new NullableToOneDataStreamInRequest + { + Data = null + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = [] + } + } + } + }; + + var queryString = new Dictionary + { + ["include"] = "videoStream,audioStreams", + ["fields[writeOnlyChannels]"] = "name,isCommercial,videoStream,audioStreams", + ["fields[dataStreams]"] = "bytesTransmitted" + }; + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = await ApiResponse.TranslateAsync(async () => + await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody, queryString)); + + response.Should().NotBeNull(); + + response.Data.Id.Should().Be(existingChannel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(newChannelName); + response.Data.Attributes.IsCommercial.Should().Be(existingChannel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().BeNull(); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Id.Should().Be(existingVideoStream.StringId); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeEmpty(); + + response.Included.Should().HaveCount(1); + response.Included.OfType().Should().ContainSingle(include => include.Id == existingVideoStream.StringId); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.UltraHighDefinitionVideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(newChannelName); + channelInDatabase.IsCommercial.Should().Be(existingChannel.IsCommercial); + channelInDatabase.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingVideoStream.Id); + + channelInDatabase.UltraHighDefinitionVideoStream.Should().BeNull(); + + channelInDatabase.AudioStreams.Should().BeEmpty(); + }); + } + + [Fact] + public async Task Can_update_resource_without_attributes_or_relationships() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.UltraHighDefinitionVideoStream = _fakers.DataStream.GenerateOne(); + existingChannel.AudioStreams = _fakers.DataStream.GenerateSet(2); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Id = existingChannel.StringId!, + Attributes = new AttributesInUpdateWriteOnlyChannelRequest(), + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest() + } + }; + + // Act + PrimaryWriteOnlyChannelResponseDocument? response = + await ApiResponse.TranslateAsync(async () => await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody)); + + response.Should().NotBeNull(); + + response.Data.Id.Should().Be(existingChannel.StringId); + response.Data.Attributes.Should().NotBeNull(); + response.Data.Attributes.Name.Should().Be(existingChannel.Name); + response.Data.Attributes.IsCommercial.Should().Be(existingChannel.IsCommercial); + response.Data.Attributes.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + response.Data.Relationships.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Should().NotBeNull(); + response.Data.Relationships.VideoStream.Data.Should().BeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Should().NotBeNull(); + response.Data.Relationships.UltraHighDefinitionVideoStream.Data.Should().BeNull(); + response.Data.Relationships.AudioStreams.Should().NotBeNull(); + response.Data.Relationships.AudioStreams.Data.Should().BeNull(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + // @formatter:wrap_chained_method_calls chop_always + // @formatter:keep_existing_linebreaks true + + WriteOnlyChannel channelInDatabase = await dbContext.WriteOnlyChannels + .Include(channel => channel.VideoStream) + .Include(channel => channel.UltraHighDefinitionVideoStream) + .Include(channel => channel.AudioStreams) + .FirstWithIdAsync(existingChannel.Id); + + // @formatter:keep_existing_linebreaks restore + // @formatter:wrap_chained_method_calls restore + + channelInDatabase.Name.Should().Be(existingChannel.Name); + channelInDatabase.IsCommercial.Should().Be(existingChannel.IsCommercial); + channelInDatabase.IsAdultOnly.Should().Be(existingChannel.IsAdultOnly); + + channelInDatabase.VideoStream.Should().NotBeNull(); + channelInDatabase.VideoStream.Id.Should().Be(existingChannel.VideoStream.Id); + + channelInDatabase.UltraHighDefinitionVideoStream.Should().NotBeNull(); + channelInDatabase.UltraHighDefinitionVideoStream.Id.Should().Be(existingChannel.UltraHighDefinitionVideoStream.Id); + + channelInDatabase.AudioStreams.Should().HaveCount(2); + }); + } + + [Fact] + public async Task Cannot_update_resource_for_missing_request_body() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + UpdateWriteOnlyChannelRequestDocument requestBody = null!; + + // Act + Func action = async () => _ = await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody); + + // Assert + await action.Should().ThrowExactlyAsync().WithParameterName("body"); + } + + [Fact] + public async Task Cannot_update_resource_with_unknown_relationship_IDs() + { + // Arrange + WriteOnlyChannel existingChannel = _fakers.WriteOnlyChannel.GenerateOne(); + existingChannel.VideoStream = _fakers.DataStream.GenerateOne(); + + await _testContext.RunOnDatabaseAsync(async dbContext => + { + dbContext.WriteOnlyChannels.Add(existingChannel); + await dbContext.SaveChangesAsync(); + }); + + string unknownDataStreamId = Unknown.StringId.For(); + + using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); + var apiClient = new RestrictedControllersClient(httpClient); + + var requestBody = new UpdateWriteOnlyChannelRequestDocument + { + Data = new DataInUpdateWriteOnlyChannelRequest + { + Id = existingChannel.StringId!, + Relationships = new RelationshipsInUpdateWriteOnlyChannelRequest + { + VideoStream = new ToOneDataStreamInRequest + { + Data = new DataStreamIdentifierInRequest + { + Id = unknownDataStreamId + } + }, + AudioStreams = new ToManyDataStreamInRequest + { + Data = + [ + new DataStreamIdentifierInRequest + { + Id = unknownDataStreamId + } + ] + } + } + } + }; + + // Act + Func action = async () => _ = await apiClient.PatchWriteOnlyChannelAsync(existingChannel.StringId!, requestBody); + + // Assert + ApiException exception = (await action.Should().ThrowExactlyAsync>()).Which; + exception.StatusCode.Should().Be((int)HttpStatusCode.NotFound); + exception.Message.Should().Be("HTTP 404: The writeOnlyChannel or a related resource does not exist."); + exception.Result.Errors.Should().HaveCount(2); + + ErrorObject error1 = exception.Result.Errors.ElementAt(0); + error1.Status.Should().Be("404"); + error1.Title.Should().Be("A related resource does not exist."); + error1.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownDataStreamId}' in relationship 'videoStream' does not exist."); + + ErrorObject error2 = exception.Result.Errors.ElementAt(1); + error2.Status.Should().Be("404"); + error2.Title.Should().Be("A related resource does not exist."); + error2.Detail.Should().Be($"Related resource of type 'dataStreams' with ID '{unknownDataStreamId}' in relationship 'audioStreams' does not exist."); + } + + public void Dispose() + { + _logHttpMessageHandler.Dispose(); + } +} diff --git a/test/OpenApiTests/AtomicOperations/Course.cs b/test/OpenApiTests/AtomicOperations/Course.cs new file mode 100644 index 0000000000..de193c6893 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/Course.cs @@ -0,0 +1,25 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.AtomicOperations", GenerateControllerEndpoints = JsonApiEndpoints.All & ~JsonApiEndpoints.DeleteRelationship, + ClientIdGeneration = ClientIdGenerationMode.Required)] +public sealed class Course : Identifiable +{ + [Attr] + public string Subject { get; set; } = null!; + + [Attr] + public string? Description { get; set; } + + [HasMany(Capabilities = HasManyCapabilities.All & ~HasManyCapabilities.AllowSet)] + public ISet TaughtBy { get; set; } = new HashSet(); + + [HasMany] + public ISet Enrollments { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/AtomicOperations/Enrollment.cs b/test/OpenApiTests/AtomicOperations/Enrollment.cs new file mode 100644 index 0000000000..c89cf2537c --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/Enrollment.cs @@ -0,0 +1,29 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.AtomicOperations")] +public sealed class Enrollment(OperationsDbContext dbContext) : Identifiable +{ + private readonly TimeProvider _timeProvider = dbContext.TimeProvider; + + private DateOnly Today => DateOnly.FromDateTime(_timeProvider.GetUtcNow().Date); + + [Attr] + public DateOnly EnrolledAt { get; set; } + + [Attr] + public DateOnly? GraduatedAt { get; set; } + + [Attr] + public bool HasGraduated => GraduatedAt != null && GraduatedAt <= Today; + + [HasOne] + public Student Student { get; set; } = null!; + + [HasOne] + public Course Course { get; set; } = null!; +} diff --git a/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..cb64a5f34b --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3682 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToCourseEnrollmentsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToCourseTaughtByRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseTaughtByRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToStudentEnrollmentsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToTeacherMentorsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToTeacherTeachesRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherTeachesRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addCourse": "#/components/schemas/createCourseOperation", + "addEnrollment": "#/components/schemas/createEnrollmentOperation", + "addStudent": "#/components/schemas/createStudentOperation", + "addTeacher": "#/components/schemas/createTeacherOperation", + "addToCourseEnrollments": "#/components/schemas/addToCourseEnrollmentsRelationshipOperation", + "addToCourseTaughtBy": "#/components/schemas/addToCourseTaughtByRelationshipOperation", + "addToStudentEnrollments": "#/components/schemas/addToStudentEnrollmentsRelationshipOperation", + "addToTeacherMentors": "#/components/schemas/addToTeacherMentorsRelationshipOperation", + "addToTeacherTeaches": "#/components/schemas/addToTeacherTeachesRelationshipOperation", + "removeCourse": "#/components/schemas/deleteCourseOperation", + "removeEnrollment": "#/components/schemas/deleteEnrollmentOperation", + "removeFromStudentEnrollments": "#/components/schemas/removeFromStudentEnrollmentsRelationshipOperation", + "removeFromTeacherMentors": "#/components/schemas/removeFromTeacherMentorsRelationshipOperation", + "removeFromTeacherTeaches": "#/components/schemas/removeFromTeacherTeachesRelationshipOperation", + "removeTeacher": "#/components/schemas/deleteTeacherOperation", + "updateCourse": "#/components/schemas/updateCourseOperation", + "updateCourseEnrollments": "#/components/schemas/updateCourseEnrollmentsRelationshipOperation", + "updateEnrollment": "#/components/schemas/updateEnrollmentOperation", + "updateEnrollmentCourse": "#/components/schemas/updateEnrollmentCourseRelationshipOperation", + "updateEnrollmentStudent": "#/components/schemas/updateEnrollmentStudentRelationshipOperation", + "updateStudent": "#/components/schemas/updateStudentOperation", + "updateStudentEnrollments": "#/components/schemas/updateStudentEnrollmentsRelationshipOperation", + "updateStudentMentor": "#/components/schemas/updateStudentMentorRelationshipOperation", + "updateTeacher": "#/components/schemas/updateTeacherOperation", + "updateTeacherMentors": "#/components/schemas/updateTeacherMentorsRelationshipOperation", + "updateTeacherTeaches": "#/components/schemas/updateTeacherTeachesRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "subject" + ], + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateEnrollmentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInCreateCourseRequest", + "enrollments": "#/components/schemas/attributesInCreateEnrollmentRequest", + "students": "#/components/schemas/attributesInCreateStudentRequest", + "teachers": "#/components/schemas/attributesInCreateTeacherRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + }, + "hasGraduated": { + "type": "boolean", + "readOnly": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInCourseResponse", + "enrollments": "#/components/schemas/attributesInEnrollmentResponse", + "students": "#/components/schemas/attributesInStudentResponse", + "teachers": "#/components/schemas/attributesInTeacherResponse" + } + }, + "x-abstract": true + }, + "attributesInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateEnrollmentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/attributesInUpdateCourseRequest", + "enrollments": "#/components/schemas/attributesInUpdateEnrollmentRequest", + "students": "#/components/schemas/attributesInUpdateStudentRequest", + "teachers": "#/components/schemas/attributesInUpdateTeacherRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "courseEnrollmentsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/courseResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "courseEnrollmentsRelationshipName": { + "enum": [ + "enrollments" + ], + "type": "string" + }, + "courseIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "courseIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/courseResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "courseResourceType": { + "enum": [ + "courses" + ], + "type": "string" + }, + "courseTaughtByRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/courseResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/courseTaughtByRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "courseTaughtByRelationshipName": { + "enum": [ + "taughtBy" + ], + "type": "string" + }, + "createCourseOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createEnrollmentOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createStudentOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createTeacherOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCourseResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCourseResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateCourseRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateEnrollmentRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateStudentRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateTeacherRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInEnrollmentResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInEnrollmentResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStudentResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInStudentResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTeacherResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInTeacherResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateCourseRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateEnrollmentRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateStudentRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateTeacherRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteCourseOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteEnrollmentOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteTeacherOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "enrollmentCourseRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentCourseRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "enrollmentCourseRelationshipName": { + "enum": [ + "course" + ], + "type": "string" + }, + "enrollmentIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "enrollmentIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "enrollmentResourceType": { + "enum": [ + "enrollments" + ], + "type": "string" + }, + "enrollmentStudentRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentStudentRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "enrollmentStudentRelationshipName": { + "enum": [ + "student" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/courseIdentifierInRequest", + "enrollments": "#/components/schemas/enrollmentIdentifierInRequest", + "students": "#/components/schemas/studentIdentifierInRequest", + "teachers": "#/components/schemas/teacherIdentifierInRequest" + } + }, + "x-abstract": true + }, + "jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableToOneTeacherInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneTeacherInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCourseResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInResponse" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateEnrollmentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "course", + "student" + ], + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInCreateCourseRequest", + "enrollments": "#/components/schemas/relationshipsInCreateEnrollmentRequest", + "students": "#/components/schemas/relationshipsInCreateStudentRequest", + "teachers": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInEnrollmentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInResponse" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInCourseResponse", + "enrollments": "#/components/schemas/relationshipsInEnrollmentResponse", + "students": "#/components/schemas/relationshipsInStudentResponse", + "teachers": "#/components/schemas/relationshipsInTeacherResponse" + } + }, + "x-abstract": true + }, + "relationshipsInStudentResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInResponse" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInTeacherResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInResponse" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateCourseRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateEnrollmentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "courses": "#/components/schemas/relationshipsInUpdateCourseRequest", + "enrollments": "#/components/schemas/relationshipsInUpdateEnrollmentRequest", + "students": "#/components/schemas/relationshipsInUpdateStudentRequest", + "teachers": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateStudentRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateTeacherRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromStudentEnrollmentsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromTeacherMentorsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromTeacherTeachesRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherTeachesRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCreateCourseRequest", + "enrollments": "#/components/schemas/dataInCreateEnrollmentRequest", + "students": "#/components/schemas/dataInCreateStudentRequest", + "teachers": "#/components/schemas/dataInCreateTeacherRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCourseResponse", + "enrollments": "#/components/schemas/dataInEnrollmentResponse", + "students": "#/components/schemas/dataInStudentResponse", + "teachers": "#/components/schemas/dataInTeacherResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInUpdateCourseRequest", + "enrollments": "#/components/schemas/dataInUpdateEnrollmentRequest", + "students": "#/components/schemas/dataInUpdateStudentRequest", + "teachers": "#/components/schemas/dataInUpdateTeacherRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "courses", + "enrollments", + "students", + "teachers" + ], + "type": "string" + }, + "studentEnrollmentsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/studentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "studentEnrollmentsRelationshipName": { + "enum": [ + "enrollments" + ], + "type": "string" + }, + "studentIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "studentIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/studentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "studentMentorRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/studentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/studentMentorRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "studentMentorRelationshipName": { + "enum": [ + "mentor" + ], + "type": "string" + }, + "studentResourceType": { + "enum": [ + "students" + ], + "type": "string" + }, + "teacherIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "teacherIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "teacherMentorsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "teacherMentorsRelationshipName": { + "enum": [ + "mentors" + ], + "type": "string" + }, + "teacherResourceType": { + "enum": [ + "teachers" + ], + "type": "string" + }, + "teacherTeachesRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherTeachesRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "teacherTeachesRelationshipName": { + "enum": [ + "teaches" + ], + "type": "string" + }, + "toManyCourseInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyCourseInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/courseIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEnrollmentInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEnrollmentInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStudentInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStudentInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyTeacherInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyTeacherInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/teacherIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneCourseInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneCourseInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneStudentInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneStudentInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/studentIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateCourseEnrollmentsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateCourseOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateEnrollmentCourseRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentCourseRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateEnrollmentOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateEnrollmentStudentRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentStudentRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateStudentEnrollmentsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateStudentMentorRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentMentorRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateStudentOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTeacherMentorsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTeacherOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateTeacherTeachesRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherTeachesRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/AtomicOperations/OperationsController.cs b/test/OpenApiTests/AtomicOperations/OperationsController.cs new file mode 100644 index 0000000000..1caad7b4d4 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/OperationsController.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.AtomicOperations; + +public sealed class OperationsController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IOperationsProcessor processor, IJsonApiRequest request, + ITargetedFields targetedFields, IAtomicOperationFilter operationFilter) + : JsonApiOperationsController(options, resourceGraph, loggerFactory, processor, request, targetedFields, operationFilter); diff --git a/test/OpenApiTests/AtomicOperations/OperationsDbContext.cs b/test/OpenApiTests/AtomicOperations/OperationsDbContext.cs new file mode 100644 index 0000000000..21164ba769 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/OperationsDbContext.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class OperationsDbContext(TimeProvider timeProvider, DbContextOptions options) + : TestableDbContext(options) +{ + internal TimeProvider TimeProvider { get; } = timeProvider; + + public DbSet Courses => Set(); + public DbSet Teachers => Set(); + public DbSet Students => Set(); + public DbSet Enrollments => Set(); +} diff --git a/test/OpenApiTests/AtomicOperations/OperationsFakers.cs b/test/OpenApiTests/AtomicOperations/OperationsFakers.cs new file mode 100644 index 0000000000..c77e045faa --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/OperationsFakers.cs @@ -0,0 +1,50 @@ +using Bogus; +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class OperationsFakers +{ + private readonly Lazy> _lazyCourseFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(course => course.Subject, faker => faker.Lorem.Word()) + .RuleFor(course => course.Description, faker => faker.Lorem.Sentence())); + + private readonly Lazy> _lazyTeacherFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(teacher => teacher.Name, faker => faker.Person.FullName) + .RuleFor(teacher => teacher.EmailAddress, faker => faker.Person.Email)); + + private readonly Lazy> _lazyStudentFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(student => student.Name, faker => faker.Person.FullName) + .RuleFor(student => student.EmailAddress, faker => faker.Person.Email)); + + private readonly Lazy> _lazyEnrollmentFaker; + + public Faker Course => _lazyCourseFaker.Value; + public Faker Teacher => _lazyTeacherFaker.Value; + public Faker Student => _lazyStudentFaker.Value; + public Faker Enrollment => _lazyEnrollmentFaker.Value; + + public OperationsFakers(IServiceProvider serviceProvider) + { + _lazyEnrollmentFaker = new Lazy>(() => new Faker() + .MakeDeterministic() + .CustomInstantiator(_ => new Enrollment(ResolveDbContext(serviceProvider))) + .RuleFor(enrollment => enrollment.EnrolledAt, faker => faker.Date.PastDateOnly()) + .RuleFor(enrollment => enrollment.GraduatedAt, faker => faker.Date.RecentDateOnly())); + } + + private OperationsDbContext ResolveDbContext(IServiceProvider serviceProvider) + { + using IServiceScope scope = serviceProvider.CreateScope(); + return scope.ServiceProvider.GetRequiredService(); + } +} diff --git a/test/OpenApiTests/AtomicOperations/OperationsTests.cs b/test/OpenApiTests/AtomicOperations/OperationsTests.cs new file mode 100644 index 0000000000..f49c10c8a9 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/OperationsTests.cs @@ -0,0 +1,2437 @@ +using System.Text.Json; +using JsonApiDotNetCore.Configuration; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.AtomicOperations; + +public sealed class OperationsTests : IClassFixture, OperationsDbContext>> +{ + private readonly OpenApiTestContext, OperationsDbContext> _testContext; + + public OperationsTests(OpenApiTestContext, OperationsDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + + var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); + options.IncludeJsonApiVersion = true; + } + + [Fact] + public async Task Operations_endpoint_is_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./operations.post").Should().BeJson(""" + { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + """); + } + + [Fact] + public async Task Operations_request_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath("operationsRequestDocument").Should().BeJson(""" + { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("atomicOperation").Should().BeJson(""" + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addCourse": "#/components/schemas/createCourseOperation", + "addEnrollment": "#/components/schemas/createEnrollmentOperation", + "addStudent": "#/components/schemas/createStudentOperation", + "addTeacher": "#/components/schemas/createTeacherOperation", + "addToCourseEnrollments": "#/components/schemas/addToCourseEnrollmentsRelationshipOperation", + "addToCourseTaughtBy": "#/components/schemas/addToCourseTaughtByRelationshipOperation", + "addToStudentEnrollments": "#/components/schemas/addToStudentEnrollmentsRelationshipOperation", + "addToTeacherMentors": "#/components/schemas/addToTeacherMentorsRelationshipOperation", + "addToTeacherTeaches": "#/components/schemas/addToTeacherTeachesRelationshipOperation", + "removeCourse": "#/components/schemas/deleteCourseOperation", + "removeEnrollment": "#/components/schemas/deleteEnrollmentOperation", + "removeFromStudentEnrollments": "#/components/schemas/removeFromStudentEnrollmentsRelationshipOperation", + "removeFromTeacherMentors": "#/components/schemas/removeFromTeacherMentorsRelationshipOperation", + "removeFromTeacherTeaches": "#/components/schemas/removeFromTeacherTeachesRelationshipOperation", + "removeTeacher": "#/components/schemas/deleteTeacherOperation", + "updateCourse": "#/components/schemas/updateCourseOperation", + "updateCourseEnrollments": "#/components/schemas/updateCourseEnrollmentsRelationshipOperation", + "updateEnrollment": "#/components/schemas/updateEnrollmentOperation", + "updateEnrollmentCourse": "#/components/schemas/updateEnrollmentCourseRelationshipOperation", + "updateEnrollmentStudent": "#/components/schemas/updateEnrollmentStudentRelationshipOperation", + "updateStudent": "#/components/schemas/updateStudentOperation", + "updateStudentEnrollments": "#/components/schemas/updateStudentEnrollmentsRelationshipOperation", + "updateStudentMentor": "#/components/schemas/updateStudentMentorRelationshipOperation", + "updateTeacher": "#/components/schemas/updateTeacherOperation", + "updateTeacherMentors": "#/components/schemas/updateTeacherMentorsRelationshipOperation", + "updateTeacherTeaches": "#/components/schemas/updateTeacherTeachesRelationshipOperation" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("addOperationCode").Should().BeJson(""" + { + "enum": [ + "add" + ], + "type": "string" + } + """); + + schemasElement.Should().ContainPath("updateOperationCode").Should().BeJson(""" + { + "enum": [ + "update" + ], + "type": "string" + } + """); + + schemasElement.Should().ContainPath("removeOperationCode").Should().BeJson(""" + { + "enum": [ + "remove" + ], + "type": "string" + } + """); + + schemasElement.Should().ContainPath("resourceInCreateRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInCreateCourseRequest", + "enrollments": "#/components/schemas/dataInCreateEnrollmentRequest", + "students": "#/components/schemas/dataInCreateStudentRequest", + "teachers": "#/components/schemas/dataInCreateTeacherRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("resourceInUpdateRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/dataInUpdateCourseRequest", + "enrollments": "#/components/schemas/dataInUpdateEnrollmentRequest", + "students": "#/components/schemas/dataInUpdateStudentRequest", + "teachers": "#/components/schemas/dataInUpdateTeacherRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("identifierInRequest").Should().BeJson(""" + { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "courses": "#/components/schemas/courseIdentifierInRequest", + "enrollments": "#/components/schemas/enrollmentIdentifierInRequest", + "students": "#/components/schemas/studentIdentifierInRequest", + "teachers": "#/components/schemas/teacherIdentifierInRequest" + } + }, + "x-abstract": true + } + """); + + schemasElement.Should().ContainPath("resourceType").Should().BeJson(""" + { + "enum": [ + "courses", + "enrollments", + "students", + "teachers" + ], + "type": "string" + } + """); + }); + } + + [Fact] + public async Task Operations_response_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath("operationsResponseDocument").Should().BeJson(""" + { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("atomicResult").Should().BeJson(""" + { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + """); + }); + } + + [Fact] + public async Task Course_operation_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + // resource operations + schemasElement.Should().ContainPath("createCourseOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInCreateCourseRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInCreateCourseRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "subject" + ], + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInCreateCourseRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("updateCourseOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInUpdateCourseRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCourseRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCourseRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInUpdateCourseRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "subject": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInUpdateCourseRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "taughtBy": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("deleteCourseOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // relationship operations + schemasElement.Should().ContainPath("updateCourseEnrollmentsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("addToCourseEnrollmentsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().NotContainPath("removeFromCourseEnrollmentsRelationshipOperation"); + + schemasElement.Should().NotContainPath("updateCourseTaughtByRelationshipOperation"); + + // shared types + schemasElement.Should().ContainPath("courseIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("courseEnrollmentsRelationshipIdentifier").Should().BeJson(""" + { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/courseResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/courseEnrollmentsRelationshipName" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("courseEnrollmentsRelationshipName").Should().BeJson(""" + { + "enum": [ + "enrollments" + ], + "type": "string" + } + """); + }); + } + + [Fact] + public async Task Student_operation_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + // resource operations + schemasElement.Should().ContainPath("createStudentOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInCreateStudentRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInCreateStudentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInCreateStudentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("updateStudentOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInUpdateStudentRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStudentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateStudentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInUpdateStudentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInUpdateStudentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "mentor": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTeacherInRequest" + } + ] + }, + "enrollments": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEnrollmentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().NotContainPath("deleteStudentOperation"); + + // relationship operations + schemasElement.Should().ContainPath("updateStudentMentorRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentMentorRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("updateStudentEnrollmentsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("addToStudentEnrollmentsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("removeFromStudentEnrollmentsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // shared types + schemasElement.Should().ContainPath("studentIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("studentMentorRelationshipIdentifier").Should().BeJson(""" + { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/studentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/studentMentorRelationshipName" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("studentMentorRelationshipName").Should().BeJson(""" + { + "enum": [ + "mentor" + ], + "type": "string" + } + """); + + schemasElement.Should().ContainPath("studentEnrollmentsRelationshipIdentifier").Should().BeJson(""" + { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/studentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/studentEnrollmentsRelationshipName" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("studentEnrollmentsRelationshipName").Should().BeJson(""" + { + "enum": [ + "enrollments" + ], + "type": "string" + } + """); + }); + } + + [Fact] + public async Task Teacher_operation_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + // resource operations + schemasElement.Should().ContainPath("createTeacherOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInCreateTeacherRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInCreateTeacherRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInCreateTeacherRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("updateTeacherOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInUpdateTeacherRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTeacherRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateTeacherRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInUpdateTeacherRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "emailAddress": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInUpdateTeacherRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "teaches": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyCourseInRequest" + } + ] + }, + "mentors": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStudentInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("deleteTeacherOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // relationship operations + schemasElement.Should().ContainPath("updateTeacherMentorsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("addToTeacherMentorsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("removeFromTeacherMentorsRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/studentIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // shared types + schemasElement.Should().ContainPath("teacherIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("teacherMentorsRelationshipIdentifier").Should().BeJson(""" + { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/teacherMentorsRelationshipName" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("teacherMentorsRelationshipName").Should().BeJson(""" + { + "enum": [ + "mentors" + ], + "type": "string" + } + """); + }); + } + + [Fact] + public async Task Enrollment_operation_component_schemas_are_exposed() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + // resource operations + schemasElement.Should().ContainPath("createEnrollmentOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInCreateEnrollmentRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInCreateEnrollmentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInCreateEnrollmentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "course", + "student" + ], + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("updateEnrollmentOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("dataInUpdateEnrollmentRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateEnrollmentRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateEnrollmentRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("attributesInUpdateEnrollmentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "enrolledAt": { + "type": "string", + "format": "date" + }, + "graduatedAt": { + "type": "string", + "format": "date", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("relationshipsInUpdateEnrollmentRequest").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "student": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStudentInRequest" + } + ] + }, + "course": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneCourseInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("deleteEnrollmentOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // relationship operations + schemasElement.Should().ContainPath("updateEnrollmentCourseRelationshipOperation").Should().BeJson(""" + { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentCourseRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/courseIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + // shared types + schemasElement.Should().ContainPath("enrollmentIdentifierInRequest").Should().BeJson(""" + { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("enrollmentCourseRelationshipIdentifier").Should().BeJson(""" + { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/enrollmentCourseRelationshipName" + } + ] + } + }, + "additionalProperties": false + } + """); + + schemasElement.Should().ContainPath("enrollmentCourseRelationshipName").Should().BeJson(""" + { + "enum": [ + "course" + ], + "type": "string" + } + """); + }); + } +} diff --git a/test/OpenApiTests/AtomicOperations/Student.cs b/test/OpenApiTests/AtomicOperations/Student.cs new file mode 100644 index 0000000000..465fa52bc0 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/Student.cs @@ -0,0 +1,23 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.AtomicOperations", GenerateControllerEndpoints = JsonApiEndpoints.All & ~JsonApiEndpoints.Delete)] +public sealed class Student : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public string? EmailAddress { get; set; } + + [HasOne] + public Teacher? Mentor { get; set; } + + [HasMany] + public ISet Enrollments { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/AtomicOperations/Teacher.cs b/test/OpenApiTests/AtomicOperations/Teacher.cs new file mode 100644 index 0000000000..86ff5bb4d4 --- /dev/null +++ b/test/OpenApiTests/AtomicOperations/Teacher.cs @@ -0,0 +1,22 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.AtomicOperations; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.AtomicOperations")] +public sealed class Teacher : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public string? EmailAddress { get; set; } + + [HasMany] + public ISet Teaches { get; set; } = new HashSet(); + + [HasMany] + public ISet Mentors { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationDbContext.cs b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationDbContext.cs new file mode 100644 index 0000000000..feb897baaa --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationDbContext.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.ClientIdGenerationModes; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ClientIdGenerationDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Players => Set(); + public DbSet Games => Set(); + public DbSet PlayerGroups => Set(); +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationFakers.cs b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationFakers.cs new file mode 100644 index 0000000000..d97da54070 --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationFakers.cs @@ -0,0 +1,29 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.ClientIdGenerationModes; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ClientIdGenerationFakers +{ + private readonly Lazy> _lazyPlayerFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(player => player.UserName, faker => faker.Person.UserName)); + + private readonly Lazy> _lazyGameFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(game => game.Title, faker => faker.Commerce.ProductName()) + .RuleFor(game => game.PurchasePrice, faker => faker.Finance.Amount(1, 80))); + + private readonly Lazy> _lazyGroupFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(playerGroup => playerGroup.Name, faker => faker.Person.Company.Name)); + + public Faker Player => _lazyPlayerFaker.Value; + public Faker Game => _lazyGameFaker.Value; + public Faker Group => _lazyGroupFaker.Value; +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs new file mode 100644 index 0000000000..91f6e20ee4 --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/ClientIdGenerationTests.cs @@ -0,0 +1,69 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ClientIdGenerationModes; + +public sealed class ClientIdGenerationTests : IClassFixture, ClientIdGenerationDbContext>> +{ + private readonly OpenApiTestContext, ClientIdGenerationDbContext> _testContext; + + public ClientIdGenerationTests(OpenApiTestContext, ClientIdGenerationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Fact] + public async Task Schema_property_for_ID_is_required_in_post_request() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.dataInCreatePlayerRequest.allOf[1]").With(dataElement => + { + dataElement.Should().ContainPath("required").With(requiredElement => + { + requiredElement.Should().ContainArrayElement("id"); + requiredElement.Should().NotContainArrayElement("lid"); + }); + + dataElement.Should().ContainPath("properties.id"); + }); + } + + [Fact] + public async Task Schema_property_for_ID_is_optional_in_post_request() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.dataInCreateGameRequest.allOf[1]").With(dataElement => + { + dataElement.Should().NotContainPath("required"); + }); + } + + [Fact] + public async Task Schema_property_for_ID_is_omitted_in_post_request() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.dataInCreatePlayerGroupRequest.allOf[1]").With(dataElement => + { + dataElement.Should().NotContainPath("required"); + }); + } +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/Game.cs b/test/OpenApiTests/ClientIdGenerationModes/Game.cs new file mode 100644 index 0000000000..c4880054c1 --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/Game.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ClientIdGenerationModes; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ClientIdGenerationModes", ClientIdGeneration = ClientIdGenerationMode.Allowed, + GenerateControllerEndpoints = JsonApiEndpoints.Post)] +public sealed class Game : Identifiable +{ + [Attr] + public string Title { get; set; } = null!; + + [Attr] + public decimal PurchasePrice { get; set; } +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..0a32442e86 --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/GeneratedSwagger/swagger.g.json @@ -0,0 +1,1633 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/games": { + "post": { + "tags": [ + "games" + ], + "summary": "Creates a new game.", + "operationId": "postGame", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the game to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createGameRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The game was successfully created, which resulted in additional changes. The newly created game is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created game can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryGameResponseDocument" + } + } + } + }, + "204": { + "description": "The game was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/playerGroups": { + "post": { + "tags": [ + "playerGroups" + ], + "summary": "Creates a new playerGroup.", + "operationId": "postPlayerGroup", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the playerGroup to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createPlayerGroupRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The playerGroup was successfully created, which resulted in additional changes. The newly created playerGroup is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created playerGroup can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryPlayerGroupResponseDocument" + } + } + } + }, + "204": { + "description": "The playerGroup was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/players": { + "post": { + "tags": [ + "players" + ], + "summary": "Creates a new player.", + "operationId": "postPlayer", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the player to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createPlayerRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The player was successfully created, which resulted in additional changes. The newly created player is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created player can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryPlayerResponseDocument" + } + } + } + }, + "204": { + "description": "The player was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateGameRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "title" + ], + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "purchasePrice": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreatePlayerGroupRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreatePlayerRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "userName" + ], + "type": "object", + "properties": { + "userName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "games": "#/components/schemas/attributesInCreateGameRequest", + "playerGroups": "#/components/schemas/attributesInCreatePlayerGroupRequest", + "players": "#/components/schemas/attributesInCreatePlayerRequest" + } + }, + "x-abstract": true + }, + "attributesInGameResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "purchasePrice": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "userName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "games": "#/components/schemas/attributesInGameResponse", + "playerGroups": "#/components/schemas/attributesInPlayerGroupResponse", + "players": "#/components/schemas/attributesInPlayerResponse" + } + }, + "x-abstract": true + }, + "createGameRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateGameRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createPlayerGroupRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreatePlayerGroupRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createPlayerRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreatePlayerRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateGameRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateGameRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreatePlayerGroupRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePlayerGroupRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePlayerGroupRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreatePlayerRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreatePlayerRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreatePlayerRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInGameResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInGameResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPlayerGroupResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPlayerGroupResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInPlayerResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInPlayerResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "gameIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "gameIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/gameResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "gameResourceType": { + "enum": [ + "games" + ], + "type": "string" + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/gameIdentifierInRequest", + "playerGroups": "#/components/schemas/playerGroupIdentifierInRequest", + "players": "#/components/schemas/playerIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "playerGroupIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "playerGroupIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/playerGroupResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "playerGroupResourceType": { + "enum": [ + "playerGroups" + ], + "type": "string" + }, + "playerIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "playerIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/playerResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "playerResourceType": { + "enum": [ + "players" + ], + "type": "string" + }, + "primaryGameResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInGameResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryPlayerGroupResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPlayerGroupResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryPlayerResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInPlayerResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreatePlayerGroupRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "players": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreatePlayerRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "ownedGames": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyGameInRequest" + } + ] + }, + "memberOf": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerGroupInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "playerGroups": "#/components/schemas/relationshipsInCreatePlayerGroupRequest", + "players": "#/components/schemas/relationshipsInCreatePlayerRequest" + } + }, + "x-abstract": true + }, + "relationshipsInPlayerGroupResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "players": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInPlayerResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "ownedGames": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyGameInResponse" + } + ] + }, + "memberOf": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyPlayerGroupInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "playerGroups": "#/components/schemas/relationshipsInPlayerGroupResponse", + "players": "#/components/schemas/relationshipsInPlayerResponse" + } + }, + "x-abstract": true + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/dataInCreateGameRequest", + "playerGroups": "#/components/schemas/dataInCreatePlayerGroupRequest", + "players": "#/components/schemas/dataInCreatePlayerRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "games": "#/components/schemas/dataInGameResponse", + "playerGroups": "#/components/schemas/dataInPlayerGroupResponse", + "players": "#/components/schemas/dataInPlayerResponse" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "games", + "playerGroups", + "players" + ], + "type": "string" + }, + "toManyGameInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/gameIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyGameInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/gameIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyPlayerGroupInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/playerGroupIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyPlayerGroupInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/playerGroupIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyPlayerInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/playerIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyPlayerInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/playerIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ClientIdGenerationModes/Player.cs b/test/OpenApiTests/ClientIdGenerationModes/Player.cs new file mode 100644 index 0000000000..e150af5756 --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/Player.cs @@ -0,0 +1,22 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ClientIdGenerationModes; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ClientIdGenerationModes", ClientIdGeneration = ClientIdGenerationMode.Required, + GenerateControllerEndpoints = JsonApiEndpoints.Post)] +public sealed class Player : Identifiable +{ + [Attr] + public string UserName { get; set; } = null!; + + [HasMany] + public List OwnedGames { get; set; } = []; + + [HasMany] + public List MemberOf { get; set; } = []; +} diff --git a/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs b/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs new file mode 100644 index 0000000000..9f2547a61f --- /dev/null +++ b/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ClientIdGenerationModes; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ClientIdGenerationModes", ClientIdGeneration = ClientIdGenerationMode.Forbidden, + GenerateControllerEndpoints = JsonApiEndpoints.Post)] +public sealed class PlayerGroup : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [HasMany] + public List Players { get; set; } = []; +} diff --git a/test/OpenApiTests/Documentation/DocumentationDbContext.cs b/test/OpenApiTests/Documentation/DocumentationDbContext.cs new file mode 100644 index 0000000000..5d6c24b9ce --- /dev/null +++ b/test/OpenApiTests/Documentation/DocumentationDbContext.cs @@ -0,0 +1,26 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_always + +namespace OpenApiTests.Documentation; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class DocumentationDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Skyscrapers => Set(); + public DbSet Elevators => Set(); + public DbSet Spaces => Set(); + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasOne(skyscraper => skyscraper.Elevator) + .WithOne(elevator => elevator.ExistsIn) + .HasForeignKey("ElevatorId"); + + base.OnModelCreating(builder); + } +} diff --git a/test/OpenApiTests/Documentation/DocumentationStartup.cs b/test/OpenApiTests/Documentation/DocumentationStartup.cs new file mode 100644 index 0000000000..318343f24e --- /dev/null +++ b/test/OpenApiTests/Documentation/DocumentationStartup.cs @@ -0,0 +1,42 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using TestBuildingBlocks; + +namespace OpenApiTests.Documentation; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class DocumentationStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.ClientIdGeneration = ClientIdGenerationMode.Allowed; + } + + protected override void SetupSwaggerGenAction(SwaggerGenOptions options) + { + options.SwaggerDoc("v1", new OpenApiInfo + { + Version = "v1", + Title = "Skyscrapers of the world", + Description = "A JSON:API service for managing skyscrapers.", + Contact = new OpenApiContact + { + Name = "Report issues", + Url = new Uri("https://github.com/json-api-dotnet/JsonApiDotNetCore/issues") + }, + License = new OpenApiLicense + { + Name = "MIT License", + Url = new Uri("https://licenses.nuget.org/MIT") + } + }); + + base.SetupSwaggerGenAction(options); + } +} diff --git a/test/OpenApiTests/Documentation/DocumentationTests.cs b/test/OpenApiTests/Documentation/DocumentationTests.cs new file mode 100644 index 0000000000..0dfc35d908 --- /dev/null +++ b/test/OpenApiTests/Documentation/DocumentationTests.cs @@ -0,0 +1,740 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +// @formatter:max_line_length 250 + +namespace OpenApiTests.Documentation; + +public sealed class DocumentationTests : IClassFixture, DocumentationDbContext>> +{ + private const string ResourceTextQueryString = + "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters."; + + private const string RelationshipTextQueryString = + "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters."; + + private readonly OpenApiTestContext, DocumentationDbContext> _testContext; + + public DocumentationTests(OpenApiTestContext, DocumentationDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Fact] + public async Task API_is_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("info").With(infoElement => + { + infoElement.Should().HaveProperty("title", "Skyscrapers of the world"); + infoElement.Should().HaveProperty("description", "A JSON:API service for managing skyscrapers."); + infoElement.Should().HaveProperty("version", "v1"); + + infoElement.Should().ContainPath("contact").With(contactElement => + { + contactElement.Should().HaveProperty("name", "Report issues"); + contactElement.Should().HaveProperty("url", "https://github.com/json-api-dotnet/JsonApiDotNetCore/issues"); + }); + + infoElement.Should().ContainPath("license").With(contactElement => + { + contactElement.Should().HaveProperty("name", "MIT License"); + contactElement.Should().HaveProperty("url", "https://licenses.nuget.org/MIT"); + }); + }); + } + + [Fact] + public async Task Endpoints_are_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./skyscrapers").With(skyscrapersElement => + { + skyscrapersElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves a collection of skyscrapers."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(2); + parametersElement.Should().HaveProperty("[0].in", "query"); + parametersElement.Should().HaveProperty("[0].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[1].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[1].in", "header"); + parametersElement.Should().HaveProperty("[1].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(3); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found skyscrapers, or an empty array if none were found."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + }); + }); + + skyscrapersElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves a collection of skyscrapers without returning them."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(2); + parametersElement.Should().HaveProperty("[0].in", "query"); + parametersElement.Should().HaveProperty("[0].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[1].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[1].in", "header"); + parametersElement.Should().HaveProperty("[1].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(3); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + }); + }); + + skyscrapersElement.Should().ContainPath("post").With(postElement => + { + postElement.Should().HaveProperty("summary", "Creates a new skyscraper."); + + postElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "query"); + parametersElement.Should().HaveProperty("[0].description", ResourceTextQueryString); + }); + + postElement.Should().HaveProperty("requestBody.description", "The attributes and relationships of the skyscraper to create."); + + postElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(6); + responsesElement.Should().HaveProperty("201.description", "The skyscraper was successfully created, which resulted in additional changes. The newly created skyscraper is returned."); + responsesElement.Should().HaveProperty("201.headers.Location.description", "The URL at which the newly created skyscraper can be retrieved."); + responsesElement.Should().HaveProperty("204.description", "The skyscraper was successfully created, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid or the request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "A related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}").With(idElement => + { + idElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves an individual skyscraper by its identifier."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found skyscraper."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + idElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves an individual skyscraper by its identifier without returning it."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + idElement.Should().ContainPath("patch").With(patchElement => + { + patchElement.Should().HaveProperty("summary", "Updates an existing skyscraper."); + + patchElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(2); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to update."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + }); + + patchElement.Should().HaveProperty("requestBody.description", "The attributes and relationships of the skyscraper to update. Omitted fields are left unchanged."); + + patchElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(6); + responsesElement.Should().HaveProperty("200.description", "The skyscraper was successfully updated, which resulted in additional changes. The updated skyscraper is returned."); + responsesElement.Should().HaveProperty("204.description", "The skyscraper was successfully updated, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid or the request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "A resource type or identifier in the request body is incompatible."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + + idElement.Should().ContainPath("delete").With(deleteElement => + { + deleteElement.Should().HaveProperty("summary", "Deletes an existing skyscraper by its identifier."); + + deleteElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to delete."); + }); + + deleteElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(2); + responsesElement.Should().HaveProperty("204.description", "The skyscraper was successfully deleted."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/elevator").With(elevatorElement => + { + elevatorElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves the related elevator of an individual skyscraper's elevator relationship."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related elevator to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found elevator, or `null` if it was not found."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + elevatorElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves the related elevator of an individual skyscraper's elevator relationship without returning it."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related elevator to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/relationships/elevator").With(elevatorElement => + { + elevatorElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves the related elevator identity of an individual skyscraper's elevator relationship."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related elevator identity to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", RelationshipTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found elevator identity, or `null` if it was not found."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + elevatorElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves the related elevator identity of an individual skyscraper's elevator relationship without returning it."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related elevator identity to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", RelationshipTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + elevatorElement.Should().ContainPath("patch").With(patchElement => + { + patchElement.Should().HaveProperty("summary", "Clears or assigns an existing elevator to the elevator relationship of an individual skyscraper."); + + patchElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose elevator relationship to assign or clear."); + }); + + patchElement.Should().HaveProperty("requestBody.description", "The identity of the elevator to assign to the elevator relationship, or `null` to clear the relationship."); + + patchElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(5); + responsesElement.Should().HaveProperty("204.description", "The elevator relationship was successfully updated, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/spaces").With(spacesElement => + { + spacesElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves the related spaces of an individual skyscraper's spaces relationship."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related spaces to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found spaces, or an empty array if none were found."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + spacesElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves the related spaces of an individual skyscraper's spaces relationship without returning them."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related spaces to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", ResourceTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/relationships/spaces").With(spacesElement => + { + spacesElement.Should().ContainPath("get").With(getElement => + { + getElement.Should().HaveProperty("summary", "Retrieves the related space identities of an individual skyscraper's spaces relationship."); + + getElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related space identities to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", RelationshipTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + getElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "Successfully returns the found space identities, or an empty array if none were found."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + spacesElement.Should().ContainPath("head").With(headElement => + { + headElement.Should().HaveProperty("summary", "Retrieves the related space identities of an individual skyscraper's spaces relationship without returning them."); + headElement.Should().HaveProperty("description", "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched."); + + headElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(3); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose related space identities to retrieve."); + parametersElement.Should().HaveProperty("[1].in", "query"); + parametersElement.Should().HaveProperty("[1].description", RelationshipTextQueryString); + parametersElement.Should().HaveProperty("[2].name", "If-None-Match"); + parametersElement.Should().HaveProperty("[2].in", "header"); + parametersElement.Should().HaveProperty("[2].description", "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + }); + + headElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(4); + responsesElement.Should().HaveProperty("200.description", "The operation completed successfully."); + responsesElement.Should().HaveProperty("200.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("200.headers.Content-Length.description", "Size of the HTTP response body, in bytes."); + responsesElement.Should().HaveProperty("304.description", "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header."); + responsesElement.Should().HaveProperty("304.headers.ETag.description", "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + responsesElement.Should().HaveProperty("400.description", "The query string is invalid."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper does not exist."); + }); + }); + + spacesElement.Should().ContainPath("post").With(postElement => + { + postElement.Should().HaveProperty("summary", "Adds existing spaces to the spaces relationship of an individual skyscraper."); + + postElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to add spaces to."); + }); + + postElement.Should().HaveProperty("requestBody.description", "The identities of the spaces to add to the spaces relationship."); + + postElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(5); + responsesElement.Should().HaveProperty("204.description", "The spaces were successfully added, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + + spacesElement.Should().ContainPath("patch").With(patchElement => + { + patchElement.Should().HaveProperty("summary", "Assigns existing spaces to the spaces relationship of an individual skyscraper."); + + patchElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper whose spaces relationship to assign."); + }); + + patchElement.Should().HaveProperty("requestBody.description", "The identities of the spaces to assign to the spaces relationship, or an empty array to clear the relationship."); + + patchElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(5); + responsesElement.Should().HaveProperty("204.description", "The spaces relationship was successfully updated, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + + spacesElement.Should().ContainPath("delete").With(deleteElement => + { + deleteElement.Should().HaveProperty("summary", "Removes existing spaces from the spaces relationship of an individual skyscraper."); + + deleteElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().HaveCount(1); + parametersElement.Should().HaveProperty("[0].in", "path"); + parametersElement.Should().HaveProperty("[0].description", "The identifier of the skyscraper to remove spaces from."); + }); + + deleteElement.Should().HaveProperty("requestBody.description", "The identities of the spaces to remove from the spaces relationship."); + + deleteElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(5); + responsesElement.Should().HaveProperty("204.description", "The spaces were successfully removed, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The request body is missing or malformed."); + responsesElement.Should().HaveProperty("404.description", "The skyscraper or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + }); + + document.Should().ContainPath("paths./operations").With(skyscrapersElement => + { + skyscrapersElement.Should().ContainPath("post").With(postElement => + { + postElement.Should().HaveProperty("summary", "Performs multiple mutations in a linear and atomic manner."); + + postElement.Should().HaveProperty("requestBody.description", "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/)."); + + postElement.Should().ContainPath("responses").With(responsesElement => + { + responsesElement.EnumerateObject().Should().HaveCount(7); + responsesElement.Should().HaveProperty("200.description", "All operations were successfully applied, which resulted in additional changes."); + responsesElement.Should().HaveProperty("204.description", "All operations were successfully applied, which did not result in additional changes."); + responsesElement.Should().HaveProperty("400.description", "The request body is missing or malformed."); + responsesElement.Should().HaveProperty("403.description", "An operation is not accessible or a client-generated ID is used."); + responsesElement.Should().HaveProperty("404.description", "A resource or a related resource does not exist."); + responsesElement.Should().HaveProperty("409.description", "The request body contains conflicting information or another resource with the same ID already exists."); + responsesElement.Should().HaveProperty("422.description", "Validation of the request body failed."); + }); + }); + }); + } + + [Fact] + public async Task Resource_types_are_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().HaveProperty("dataInUpdateElevatorRequest.description", "An elevator within a skyscraper."); + schemasElement.Should().HaveProperty("dataInCreateElevatorRequest.description", "An elevator within a skyscraper."); + schemasElement.Should().HaveProperty("dataInElevatorResponse.description", "An elevator within a skyscraper."); + + schemasElement.Should().HaveProperty("dataInUpdateSkyscraperRequest.description", "A tall, continuously habitable building having multiple floors."); + schemasElement.Should().HaveProperty("dataInCreateSkyscraperRequest.description", "A tall, continuously habitable building having multiple floors."); + schemasElement.Should().HaveProperty("dataInSkyscraperResponse.description", "A tall, continuously habitable building having multiple floors."); + + schemasElement.Should().HaveProperty("dataInUpdateSpaceRequest.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); + schemasElement.Should().HaveProperty("dataInCreateSpaceRequest.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); + schemasElement.Should().HaveProperty("dataInSpaceResponse.description", "A space within a skyscraper, such as an office, hotel, residential space, or retail space."); + }); + } + + [Fact] + public async Task Attributes_are_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().HaveProperty("attributesInUpdateElevatorRequest.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); + schemasElement.Should().HaveProperty("attributesInCreateElevatorRequest.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); + schemasElement.Should().HaveProperty("attributesInElevatorResponse.allOf[1].properties.floorCount.description", "The number of floors this elevator provides access to."); + + schemasElement.Should().HaveProperty("attributesInUpdateSkyscraperRequest.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); + schemasElement.Should().HaveProperty("attributesInCreateSkyscraperRequest.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); + schemasElement.Should().HaveProperty("attributesInSkyscraperResponse.allOf[1].properties.heightInMeters.description", "The height of this building, in meters."); + + schemasElement.Should().ContainPath("attributesInUpdateSpaceRequest.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); + propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); + }); + + schemasElement.Should().ContainPath("attributesInCreateSpaceRequest.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); + propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); + }); + + schemasElement.Should().ContainPath("attributesInSpaceResponse.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("floorNumber.description", "The floor number on which this space resides."); + propertiesElement.Should().HaveProperty("kind.description", "The kind of this space."); + }); + }); + } + + [Fact] + public async Task Relationships_are_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().HaveProperty("relationshipsInUpdateElevatorRequest.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); + schemasElement.Should().HaveProperty("relationshipsInCreateElevatorRequest.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); + schemasElement.Should().HaveProperty("relationshipsInElevatorResponse.allOf[1].properties.existsIn.description", "The skyscraper this elevator exists in."); + + schemasElement.Should().ContainPath("relationshipsInUpdateSkyscraperRequest.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); + propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); + }); + + schemasElement.Should().ContainPath("relationshipsInCreateSkyscraperRequest.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); + propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); + }); + + schemasElement.Should().ContainPath("relationshipsInSkyscraperResponse.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("elevator.description", "An optional elevator within this building, providing access to spaces."); + propertiesElement.Should().HaveProperty("spaces.description", "The spaces within this building."); + }); + + schemasElement.Should().HaveProperty("relationshipsInUpdateSpaceRequest.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); + schemasElement.Should().HaveProperty("relationshipsInCreateSpaceRequest.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); + schemasElement.Should().HaveProperty("relationshipsInSpaceResponse.allOf[1].properties.existsIn.description", "The skyscraper this space exists in."); + }); + } + + [Fact] + public async Task Enums_are_documented() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().HaveProperty("spaceKind.description", "Lists the various kinds of spaces within a skyscraper."); + }); + } + + [Fact] + public async Task Forbidden_status_is_added_when_client_generated_IDs_are_disabled() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./elevators.post.responses").With(responsesElement => + { + responsesElement.Should().HaveProperty("403.description", "Client-generated IDs cannot be used at this endpoint."); + }); + } +} diff --git a/test/OpenApiTests/Documentation/Elevator.cs b/test/OpenApiTests/Documentation/Elevator.cs new file mode 100644 index 0000000000..c739454c55 --- /dev/null +++ b/test/OpenApiTests/Documentation/Elevator.cs @@ -0,0 +1,26 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Documentation; + +/// +/// An elevator within a skyscraper. +/// +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Documentation", ClientIdGeneration = ClientIdGenerationMode.Forbidden)] +public sealed class Elevator : Identifiable +{ + /// + /// The number of floors this elevator provides access to. + /// + [Attr] + public int FloorCount { get; set; } + + /// + /// The skyscraper this elevator exists in. + /// + [HasOne] + public Skyscraper ExistsIn { get; set; } = null!; +} diff --git a/test/OpenApiTests/Documentation/ErrorResponseTests.cs b/test/OpenApiTests/Documentation/ErrorResponseTests.cs new file mode 100644 index 0000000000..0bae066f00 --- /dev/null +++ b/test/OpenApiTests/Documentation/ErrorResponseTests.cs @@ -0,0 +1,332 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.Documentation; + +public sealed class ErrorResponseTests : IClassFixture, DocumentationDbContext>> +{ + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + + private readonly OpenApiTestContext, DocumentationDbContext> _testContext; + + public ErrorResponseTests(OpenApiTestContext, DocumentationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Fact] + public async Task Applicable_error_status_codes_with_schema_are_provided_on_endpoints() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./skyscrapers").With(skyscrapersElement => + { + skyscrapersElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(1); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + skyscrapersElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(1); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + + skyscrapersElement.Should().ContainPath("post.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}").With(idElement => + { + idElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + idElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + + idElement.Should().ContainPath("patch.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + idElement.Should().ContainPath("delete.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(1); + + errorStatusCodeProperties[0].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/elevator").With(elevatorElement => + { + elevatorElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + elevatorElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/relationships/elevator").With(elevatorElement => + { + elevatorElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + elevatorElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + + elevatorElement.Should().ContainPath("patch.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/spaces").With(spacesElement => + { + spacesElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + spacesElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + }); + + document.Should().ContainPath("paths./skyscrapers/{id}/relationships/spaces").With(spacesElement => + { + spacesElement.Should().ContainPath("get.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + spacesElement.Should().ContainPath("head.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(2); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + + errorStatusCodeProperties.Should().AllSatisfy(property => property.Value.Should().NotContainPath("content")); + }); + + spacesElement.Should().ContainPath("post.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + spacesElement.Should().ContainPath("patch.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + + spacesElement.Should().ContainPath("delete.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(4); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("404"); + errorStatusCodeProperties[2].Name.Should().Be("409"); + errorStatusCodeProperties[3].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + }); + + document.Should().ContainPath("paths./operations").With(skyscrapersElement => + { + skyscrapersElement.Should().ContainPath("post.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(5); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("403"); + errorStatusCodeProperties[2].Name.Should().Be("404"); + errorStatusCodeProperties[3].Name.Should().Be("409"); + errorStatusCodeProperties[4].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedOperationsMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + }); + } + + [Fact] + public async Task Forbidden_status_is_added_when_client_generated_IDs_are_disabled() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./elevators.post.responses").With(responsesElement => + { + JsonProperty[] errorStatusCodeProperties = responsesElement.EnumerateObject().Where(IsErrorStatusCode).ToArray(); + errorStatusCodeProperties.Should().HaveCount(5); + + errorStatusCodeProperties[0].Name.Should().Be("400"); + errorStatusCodeProperties[1].Name.Should().Be("403"); + errorStatusCodeProperties[2].Name.Should().Be("404"); + errorStatusCodeProperties[3].Name.Should().Be("409"); + errorStatusCodeProperties[4].Name.Should().Be("422"); + + errorStatusCodeProperties.Should().AllSatisfy(property => + property.Value.Should().ContainPath($"content.{EscapedJsonApiMediaType}.schema.$ref").ShouldBeSchemaReferenceId("errorResponseDocument")); + }); + } + + private static bool IsErrorStatusCode(JsonProperty statusCodeProperty) + { + return int.TryParse(statusCodeProperty.Name, out int statusCodeValue) && statusCodeValue >= 400; + } +} diff --git a/test/OpenApiTests/Documentation/OperationsController.cs b/test/OpenApiTests/Documentation/OperationsController.cs new file mode 100644 index 0000000000..17129d3407 --- /dev/null +++ b/test/OpenApiTests/Documentation/OperationsController.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.Documentation; + +public sealed class OperationsController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IOperationsProcessor processor, IJsonApiRequest request, + ITargetedFields targetedFields, IAtomicOperationFilter operationFilter) + : JsonApiOperationsController(options, resourceGraph, loggerFactory, processor, request, targetedFields, operationFilter); diff --git a/test/OpenApiTests/Documentation/Skyscraper.cs b/test/OpenApiTests/Documentation/Skyscraper.cs new file mode 100644 index 0000000000..57474ba770 --- /dev/null +++ b/test/OpenApiTests/Documentation/Skyscraper.cs @@ -0,0 +1,33 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Documentation; + +/// +/// A tall, continuously habitable building having multiple floors. +/// +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Documentation")] +public sealed class Skyscraper : Identifiable +{ + /// + /// The height of this building, in meters. + /// + [Attr] + [Required] + public int? HeightInMeters { get; set; } + + /// + /// An optional elevator within this building, providing access to spaces. + /// + [HasOne] + public Elevator? Elevator { get; set; } + + /// + /// The spaces within this building. + /// + [HasMany] + public ISet Spaces { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/Documentation/Space.cs b/test/OpenApiTests/Documentation/Space.cs new file mode 100644 index 0000000000..196780dd34 --- /dev/null +++ b/test/OpenApiTests/Documentation/Space.cs @@ -0,0 +1,31 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Documentation; + +/// +/// A space within a skyscraper, such as an office, hotel, residential space, or retail space. +/// +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Documentation")] +public sealed class Space : Identifiable +{ + /// + /// The floor number on which this space resides. + /// + [Attr] + public int FloorNumber { get; set; } + + /// + /// The kind of this space. + /// + [Attr] + public SpaceKind Kind { get; set; } + + /// + /// The skyscraper this space exists in. + /// + [HasOne] + public Skyscraper ExistsIn { get; set; } = null!; +} diff --git a/test/OpenApiTests/Documentation/SpaceKind.cs b/test/OpenApiTests/Documentation/SpaceKind.cs new file mode 100644 index 0000000000..a4a3b231b0 --- /dev/null +++ b/test/OpenApiTests/Documentation/SpaceKind.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.Documentation; + +/// +/// Lists the various kinds of spaces within a skyscraper. +/// +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum SpaceKind +{ + Office, + Hotel, + Residential, + Retail +} diff --git a/test/OpenApiTests/Headers/Country.cs b/test/OpenApiTests/Headers/Country.cs new file mode 100644 index 0000000000..a0398c03bc --- /dev/null +++ b/test/OpenApiTests/Headers/Country.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Headers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Headers")] +public sealed class Country : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public long Population { get; set; } + + [HasMany] + public ISet Languages { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..735ed22d80 --- /dev/null +++ b/test/OpenApiTests/Headers/GeneratedSwagger/swagger.g.json @@ -0,0 +1,2249 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/countries": { + "get": { + "tags": [ + "countries" + ], + "summary": "Retrieves a collection of countries.", + "operationId": "getCountryCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found countries, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/countryCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "countries" + ], + "summary": "Retrieves a collection of countries without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCountryCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "countries" + ], + "summary": "Creates a new country.", + "operationId": "postCountry", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the country to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createCountryRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The country was successfully created, which resulted in additional changes. The newly created country is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created country can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCountryResponseDocument" + } + } + } + }, + "204": { + "description": "The country was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/countries/{id}": { + "get": { + "tags": [ + "countries" + ], + "summary": "Retrieves an individual country by its identifier.", + "operationId": "getCountry", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found country.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCountryResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "countries" + ], + "summary": "Retrieves an individual country by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCountry", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The country does not exist." + } + } + }, + "patch": { + "tags": [ + "countries" + ], + "summary": "Updates an existing country.", + "operationId": "patchCountry", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the country to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateCountryRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The country was successfully updated, which resulted in additional changes. The updated country is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCountryResponseDocument" + } + } + } + }, + "204": { + "description": "The country was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "countries" + ], + "summary": "Deletes an existing country by its identifier.", + "operationId": "deleteCountry", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "204": { + "description": "The country was successfully deleted." + }, + "404": { + "description": "The country does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/countries/{id}/languages": { + "get": { + "tags": [ + "countries" + ], + "summary": "Retrieves the related languages of an individual country's languages relationship.", + "operationId": "getCountryLanguages", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country whose related languages to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found languages, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/languageCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "countries" + ], + "summary": "Retrieves the related languages of an individual country's languages relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCountryLanguages", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country whose related languages to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The country does not exist." + } + } + } + }, + "/countries/{id}/relationships/languages": { + "get": { + "tags": [ + "countries" + ], + "summary": "Retrieves the related language identities of an individual country's languages relationship.", + "operationId": "getCountryLanguagesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country whose related language identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found language identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/languageIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "countries" + ], + "summary": "Retrieves the related language identities of an individual country's languages relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCountryLanguagesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country whose related language identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The country does not exist." + } + } + }, + "post": { + "tags": [ + "countries" + ], + "summary": "Adds existing languages to the languages relationship of an individual country.", + "operationId": "postCountryLanguagesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to add languages to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the languages to add to the languages relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The languages were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "countries" + ], + "summary": "Assigns existing languages to the languages relationship of an individual country.", + "operationId": "patchCountryLanguagesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country whose languages relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the languages to assign to the languages relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The languages relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "countries" + ], + "summary": "Removes existing languages from the languages relationship of an individual country.", + "operationId": "deleteCountryLanguagesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the country to remove languages from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the languages to remove from the languages relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The languages were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The country or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCountryResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInCreateCountryRequest" + } + }, + "x-abstract": true + }, + "attributesInLanguageResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInCountryResponse", + "languages": "#/components/schemas/attributesInLanguageResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "population": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/attributesInUpdateCountryRequest" + } + }, + "x-abstract": true + }, + "countryCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInCountryResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createCountryRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCountryRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCountryResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCountryResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCountryResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateCountryRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateCountryRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateCountryRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLanguageResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInLanguageResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateCountryRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateCountryRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateCountryRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "languages": "#/components/schemas/languageIdentifierInRequest" + } + }, + "x-abstract": true + }, + "languageCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInLanguageResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "languageIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/languageIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "languageIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "languageIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/languageResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "languageResourceType": { + "enum": [ + "languages" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "primaryCountryResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCountryResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCountryResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInCreateCountryRequest" + } + }, + "x-abstract": true + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInCountryResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateCountryRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "languages": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyLanguageInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "countries": "#/components/schemas/relationshipsInUpdateCountryRequest" + } + }, + "x-abstract": true + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInCreateCountryRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInCountryResponse", + "languages": "#/components/schemas/dataInLanguageResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "countries": "#/components/schemas/dataInUpdateCountryRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "countries", + "languages" + ], + "type": "string" + }, + "toManyLanguageInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/languageIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyLanguageInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/languageIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateCountryRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateCountryRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/Headers/HeaderDbContext.cs b/test/OpenApiTests/Headers/HeaderDbContext.cs new file mode 100644 index 0000000000..02d4bea655 --- /dev/null +++ b/test/OpenApiTests/Headers/HeaderDbContext.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.Headers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class HeaderDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Countries => Set(); + public DbSet Languages => Set(); +} diff --git a/test/OpenApiTests/Headers/HeaderFakers.cs b/test/OpenApiTests/Headers/HeaderFakers.cs new file mode 100644 index 0000000000..cb4c50eef3 --- /dev/null +++ b/test/OpenApiTests/Headers/HeaderFakers.cs @@ -0,0 +1,36 @@ +using System.Globalization; +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.Headers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class HeaderFakers +{ + private static readonly Lazy LazyLanguageNames = new(() => CultureInfo + .GetCultures(CultureTypes.NeutralCultures) + .Select(culture => culture.DisplayName) + .ToArray()); + + private static readonly Lazy LazyLanguageCodes = new(() => CultureInfo + .GetCultures(CultureTypes.NeutralCultures) + .Select(culture => culture.ThreeLetterISOLanguageName) + .ToArray()); + + private readonly Lazy> _lazyCountryFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(country => country.Name, faker => faker.Address.Country()) + .RuleFor(country => country.Population, faker => faker.Random.Long(0, 2_000_000_000))); + + private readonly Lazy> _lazyLanguageFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(language => language.Name, faker => faker.PickRandom(LazyLanguageNames.Value)) + .RuleFor(language => language.Code, faker => faker.PickRandom(LazyLanguageCodes.Value))); + + public Faker Country => _lazyCountryFaker.Value; + public Faker Language => _lazyLanguageFaker.Value; +} diff --git a/test/OpenApiTests/Headers/HeaderTests.cs b/test/OpenApiTests/Headers/HeaderTests.cs new file mode 100644 index 0000000000..4e363b2c89 --- /dev/null +++ b/test/OpenApiTests/Headers/HeaderTests.cs @@ -0,0 +1,147 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.Headers; + +public sealed class HeaderTests : IClassFixture, HeaderDbContext>> +{ + private readonly OpenApiTestContext, HeaderDbContext> _testContext; + + public HeaderTests(OpenApiTestContext, HeaderDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("/countries.get")] + [InlineData("/countries.head")] + [InlineData("/countries/{id}.get")] + [InlineData("/countries/{id}.head")] + [InlineData("/countries/{id}/languages.get")] + [InlineData("/countries/{id}/languages.head")] + [InlineData("/countries/{id}/relationships/languages.get")] + [InlineData("/countries/{id}/relationships/languages.head")] + public async Task Endpoints_have_caching_headers(string endpointPath) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"paths.{endpointPath}.parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().ContainSingle(parameterElement => parameterElement.GetProperty("in").ValueEquals("header")).Subject + .With(parameterElement => + { + parameterElement.Should().HaveProperty("name", "If-None-Match"); + parameterElement.Should().NotContainPath("required"); + + parameterElement.Should().HaveProperty("description", + "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint."); + + parameterElement.Should().ContainPath("schema").With(schemaElement => + { + schemaElement.Should().HaveProperty("type", "string"); + }); + }); + }); + + document.Should().ContainPath($"paths.{endpointPath}.responses.200.headers.ETag").With(AssertETag); + document.Should().ContainPath($"paths.{endpointPath}.responses.304.headers.ETag").With(AssertETag); + + return; + + static void AssertETag(JsonElement etagElement) + { + etagElement.Should().HaveProperty("description", + "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes."); + + etagElement.Should().HaveProperty("required", true); + + etagElement.Should().ContainPath("schema").With(schemaElement => + { + schemaElement.Should().HaveProperty("type", "string"); + }); + } + } + + [Theory] + [InlineData("/countries.post")] + [InlineData("/countries/{id}.patch")] + [InlineData("/countries/{id}.delete")] + [InlineData("/countries/{id}/relationships/languages.post")] + [InlineData("/countries/{id}/relationships/languages.patch")] + [InlineData("/countries/{id}/relationships/languages.delete")] + public async Task Endpoints_do_not_have_caching_headers(string endpointPath) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"paths.{endpointPath}.parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().NotContain(parameterElement => parameterElement.GetProperty("name").ValueEquals("If-None-Match")); + }); + + document.Should().ContainPath($"paths.{endpointPath}.responses").With(responsesElement => + { + foreach (JsonProperty responseProperty in responsesElement.EnumerateObject()) + { + responseProperty.Value.Should().NotContainPath("headers.ETag"); + } + }); + } + + [Theory] + [InlineData("/countries.head")] + [InlineData("/countries/{id}.head")] + [InlineData("/countries/{id}/languages.head")] + [InlineData("/countries/{id}/relationships/languages.head")] + public async Task Endpoints_have_content_length_response_header(string endpointPath) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"paths.{endpointPath}.responses.200.headers.Content-Length").With(contentLengthElement => + { + contentLengthElement.Should().HaveProperty("description", "Size of the HTTP response body, in bytes."); + + contentLengthElement.Should().HaveProperty("required", true); + + contentLengthElement.Should().ContainPath("schema").With(schemaElement => + { + schemaElement.Should().HaveProperty("type", "integer"); + schemaElement.Should().HaveProperty("format", "int64"); + }); + }); + } + + [Fact] + public async Task Post_resource_endpoint_has_location_response_header() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./countries.post.responses.201.headers.Location").With(locationElement => + { + locationElement.Should().HaveProperty("description", "The URL at which the newly created country can be retrieved."); + + locationElement.Should().HaveProperty("required", true); + + locationElement.Should().ContainPath("schema").With(schemaElement => + { + schemaElement.Should().HaveProperty("type", "string"); + schemaElement.Should().HaveProperty("format", "uri"); + }); + }); + } +} diff --git a/test/OpenApiTests/Headers/Language.cs b/test/OpenApiTests/Headers/Language.cs new file mode 100644 index 0000000000..3f2eae5ff3 --- /dev/null +++ b/test/OpenApiTests/Headers/Language.cs @@ -0,0 +1,16 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Headers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Headers")] +public sealed class Language : Identifiable +{ + [Attr] + public string Code { get; set; } = null!; + + [Attr] + public string Name { get; set; } = null!; +} diff --git a/test/OpenApiTests/JsonPathBuilder.cs b/test/OpenApiTests/JsonPathBuilder.cs new file mode 100644 index 0000000000..b3c16e4a65 --- /dev/null +++ b/test/OpenApiTests/JsonPathBuilder.cs @@ -0,0 +1,76 @@ +using System.Collections.ObjectModel; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources.Annotations; + +#pragma warning disable AV1008 // Class should not be static + +namespace OpenApiTests; + +internal static class JsonPathBuilder +{ + public static readonly IReadOnlyCollection KnownEndpoints = + [ + JsonApiEndpoints.GetCollection, + JsonApiEndpoints.GetSingle, + JsonApiEndpoints.GetSecondary, + JsonApiEndpoints.GetRelationship, + JsonApiEndpoints.Post, + JsonApiEndpoints.PostRelationship, + JsonApiEndpoints.Patch, + JsonApiEndpoints.PatchRelationship, + JsonApiEndpoints.Delete, + JsonApiEndpoints.DeleteRelationship + ]; + + public static IReadOnlyDictionary> GetEndpointPaths(ResourceType resourceType) + { + var endpointToPathMap = new Dictionary> + { + [JsonApiEndpoints.GetCollection] = + [ + $"paths./{resourceType.PublicName}.get", + $"paths./{resourceType.PublicName}.head" + ], + [JsonApiEndpoints.GetSingle] = + [ + $"paths./{resourceType.PublicName}/{{id}}.get", + $"paths./{resourceType.PublicName}/{{id}}.head" + ], + [JsonApiEndpoints.GetSecondary] = [], + [JsonApiEndpoints.GetRelationship] = [], + [JsonApiEndpoints.Post] = [$"paths./{resourceType.PublicName}.post"], + [JsonApiEndpoints.PostRelationship] = [], + [JsonApiEndpoints.Patch] = [$"paths./{resourceType.PublicName}/{{id}}.patch"], + [JsonApiEndpoints.PatchRelationship] = [], + [JsonApiEndpoints.Delete] = [$"paths./{resourceType.PublicName}/{{id}}.delete"], + [JsonApiEndpoints.DeleteRelationship] = [] + }; + + foreach (RelationshipAttribute relationship in resourceType.Relationships) + { + endpointToPathMap[JsonApiEndpoints.GetSecondary].AddRange([ + $"paths./{resourceType.PublicName}/{{id}}/{relationship.PublicName}.get", + $"paths./{resourceType.PublicName}/{{id}}/{relationship.PublicName}.head" + ]); + + endpointToPathMap[JsonApiEndpoints.GetRelationship].AddRange([ + $"paths./{resourceType.PublicName}/{{id}}/relationships/{relationship.PublicName}.get", + $"paths./{resourceType.PublicName}/{{id}}/relationships/{relationship.PublicName}.head" + ]); + + endpointToPathMap[JsonApiEndpoints.PatchRelationship].Add($"paths./{resourceType.PublicName}/{{id}}/relationships/{relationship.PublicName}.patch"); + + if (relationship is HasManyAttribute) + { + endpointToPathMap[JsonApiEndpoints.PostRelationship].Add( + $"paths./{resourceType.PublicName}/{{id}}/relationships/{relationship.PublicName}.post"); + + endpointToPathMap[JsonApiEndpoints.DeleteRelationship].Add( + $"paths./{resourceType.PublicName}/{{id}}/relationships/{relationship.PublicName}.delete"); + } + } + + return endpointToPathMap.ToDictionary(pair => pair.Key, pair => pair.Value.AsReadOnly()).AsReadOnly(); + } +} diff --git a/test/OpenApiTests/LegacyOpenApi/AircraftKind.cs b/test/OpenApiTests/LegacyOpenApi/AircraftKind.cs new file mode 100644 index 0000000000..0b0ceb63e5 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/AircraftKind.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum AircraftKind +{ + Turboprops, + LightJet, + MidSizeJet, + JumboJet +} diff --git a/test/OpenApiTests/LegacyOpenApi/Airline.cs b/test/OpenApiTests/LegacyOpenApi/Airline.cs new file mode 100644 index 0000000000..8a49eee69b --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/Airline.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +/// +/// Lists the various airlines used in this API. +/// +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum Airline : byte +{ + DeltaAirLines, + LufthansaGroup, + AirFranceKlm +} diff --git a/test/OpenApiTests/LegacyOpenApi/Airplane.cs b/test/OpenApiTests/LegacyOpenApi/Airplane.cs new file mode 100644 index 0000000000..aa89d99f61 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/Airplane.cs @@ -0,0 +1,44 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.LegacyOpenApi")] +public sealed class Airplane : Identifiable +{ + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] + [MaxLength(255)] + public string Name { get; set; } = null!; + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] + [MaxLength(16)] + public string? SerialNumber { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] + public int? AirtimeInHours { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] + public DateTime? LastServicedAt { get; set; } + + /// + /// Gets the day on which this airplane was manufactured. + /// + [Attr] + public DateTime ManufacturedAt { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] + public bool IsInMaintenance { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] + [MaxLength(85)] + public string? ManufacturedInCity { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView)] + public AircraftKind Kind { get; set; } + + [HasMany] + public ISet Flights { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/LegacyOpenApi/CabinArea.cs b/test/OpenApiTests/LegacyOpenApi/CabinArea.cs new file mode 100644 index 0000000000..e9c3ec151a --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/CabinArea.cs @@ -0,0 +1,11 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum CabinArea +{ + FirstClass, + BusinessClass, + EconomyClass +} diff --git a/test/OpenApiTests/LegacyOpenApi/Flight.cs b/test/OpenApiTests/LegacyOpenApi/Flight.cs new file mode 100644 index 0000000000..5baa315523 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/Flight.cs @@ -0,0 +1,45 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.LegacyOpenApi")] +public sealed class Flight : Identifiable +{ + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] + [MaxLength(40)] + public string FinalDestination { get; set; } = null!; + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] + [MaxLength(2000)] + public string? StopOverDestination { get; set; } + + [Attr(PublicName = "operated-by", Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] + public Airline Airline { get; set; } + + [Attr] + public DateTime? DepartsAt { get; set; } + + [Attr] + public DateTime? ArrivesAt { get; set; } + + [HasMany] + public ISet CabinCrewMembers { get; set; } = new HashSet(); + + [HasOne] + public FlightAttendant Purser { get; set; } = null!; + + [HasOne] + public FlightAttendant? BackupPurser { get; set; } + + [Attr] + [NotMapped] + public ICollection ServicesOnBoard { get; set; } = new HashSet(); + + [HasMany] + public ICollection Passengers { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs b/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs new file mode 100644 index 0000000000..6eb6872072 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs @@ -0,0 +1,39 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.LegacyOpenApi")] +public sealed class FlightAttendant : Identifiable +{ + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowFilter)] + public override string Id { get; set; } = null!; + + [Attr(Capabilities = AttrCapabilities.None)] + public FlightAttendantExpertiseLevel ExpertiseLevel { get; set; } + + [Attr(Capabilities = AttrCapabilities.All)] + [Required] + [EmailAddress] + public string? EmailAddress { get; set; } + + [Attr(Capabilities = AttrCapabilities.All)] + [Range(18, 75)] + public int Age { get; set; } + + [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate)] + [Url] + public string ProfileImageUrl { get; set; } = null!; + + [Attr] + public long DistanceTraveledInKilometers { get; set; } + + [HasMany] + public ISet ScheduledForFlights { get; set; } = new HashSet(); + + [HasMany] + public ISet PurserOnFlights { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/LegacyOpenApi/FlightAttendantExpertiseLevel.cs b/test/OpenApiTests/LegacyOpenApi/FlightAttendantExpertiseLevel.cs new file mode 100644 index 0000000000..cb5f276014 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/FlightAttendantExpertiseLevel.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum FlightAttendantExpertiseLevel +{ + Junior, + Intermediate, + Senior, + Purser +} diff --git a/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..f72814347b --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/GeneratedSwagger/swagger.g.json @@ -0,0 +1,8858 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/api/airplanes": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves a collection of airplanes.", + "operationId": "get-airplane-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found airplanes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/airplane-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves a collection of airplanes without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "airplanes" + ], + "summary": "Creates a new airplane.", + "operationId": "post-airplane", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the airplane to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-airplane-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The airplane was successfully created, which resulted in additional changes. The newly created airplane is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created airplane can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "204": { + "description": "The airplane was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/airplanes/{id}": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves an individual airplane by its identifier.", + "operationId": "get-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found airplane.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves an individual airplane by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + }, + "patch": { + "tags": [ + "airplanes" + ], + "summary": "Updates an existing airplane.", + "operationId": "patch-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the airplane to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-airplane-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The airplane was successfully updated, which resulted in additional changes. The updated airplane is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "204": { + "description": "The airplane was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "airplanes" + ], + "summary": "Deletes an existing airplane by its identifier.", + "operationId": "delete-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The airplane was successfully deleted." + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/airplanes/{id}/flights": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flights of an individual airplane's flights relationship.", + "operationId": "get-airplane-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flights of an individual airplane's flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + } + }, + "/api/airplanes/{id}/relationships/flights": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flight identities of an individual airplane's flights relationship.", + "operationId": "get-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flight identities of an individual airplane's flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + }, + "post": { + "tags": [ + "airplanes" + ], + "summary": "Adds existing flights to the flights relationship of an individual airplane.", + "operationId": "post-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "airplanes" + ], + "summary": "Assigns existing flights to the flights relationship of an individual airplane.", + "operationId": "patch-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "airplanes" + ], + "summary": "Removes existing flights from the flights relationship of an individual airplane.", + "operationId": "delete-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves a collection of flight-attendants.", + "operationId": "get-flight-attendant-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendants, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves a collection of flight-attendants without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Creates a new flight-attendant.", + "operationId": "post-flight-attendant", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight-attendant to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-flight-attendant-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The flight-attendant was successfully created, which resulted in additional changes. The newly created flight-attendant is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created flight-attendant can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "204": { + "description": "The flight-attendant was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves an individual flight-attendant by its identifier.", + "operationId": "get-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves an individual flight-attendant by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Updates an existing flight-attendant.", + "operationId": "patch-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight-attendant to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-flight-attendant-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The flight-attendant was successfully updated, which resulted in additional changes. The updated flight-attendant is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "204": { + "description": "The flight-attendant was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Deletes an existing flight-attendant by its identifier.", + "operationId": "delete-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The flight-attendant was successfully deleted." + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}/purser-on-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's purser-on-flights relationship.", + "operationId": "get-flight-attendant-purser-on-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's purser-on-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-purser-on-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + } + }, + "/api/flight-attendants/{id}/relationships/purser-on-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's purser-on-flights relationship.", + "operationId": "get-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's purser-on-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Adds existing flights to the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "post-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the purser-on-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Assigns existing flights to the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "patch-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose purser-on-flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the purser-on-flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The purser-on-flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Removes existing flights from the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "delete-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the purser-on-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}/scheduled-for-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's scheduled-for-flights relationship.", + "operationId": "get-flight-attendant-scheduled-for-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's scheduled-for-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-scheduled-for-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + } + }, + "/api/flight-attendants/{id}/relationships/scheduled-for-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's scheduled-for-flights relationship.", + "operationId": "get-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's scheduled-for-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Adds existing flights to the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "post-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the scheduled-for-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Assigns existing flights to the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "patch-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose scheduled-for-flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the scheduled-for-flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The scheduled-for-flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Removes existing flights from the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "delete-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the scheduled-for-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves a collection of flights.", + "operationId": "get-flight-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves a collection of flights without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Creates a new flight.", + "operationId": "post-flight", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-flight-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The flight was successfully created, which resulted in additional changes. The newly created flight is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created flight can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "204": { + "description": "The flight was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves an individual flight by its identifier.", + "operationId": "get-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves an individual flight by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Updates an existing flight.", + "operationId": "patch-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-flight-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The flight was successfully updated, which resulted in additional changes. The updated flight is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "204": { + "description": "The flight was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Deletes an existing flight by its identifier.", + "operationId": "delete-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The flight was successfully deleted." + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/backup-purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's backup-purser relationship.", + "operationId": "get-flight-backup-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-secondary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's backup-purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-backup-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/backup-purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's backup-purser relationship.", + "operationId": "get-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-flight-attendant-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's backup-purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Clears or assigns an existing flight-attendant to the backup-purser relationship of an individual flight.", + "operationId": "patch-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose backup-purser relationship to assign or clear.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the flight-attendant to assign to the backup-purser relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The backup-purser relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/cabin-crew-members": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendants of an individual flight's cabin-crew-members relationship.", + "operationId": "get-flight-cabin-crew-members", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendants to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendants, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendants of an individual flight's cabin-crew-members relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-cabin-crew-members", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendants to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/cabin-crew-members": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identities of an individual flight's cabin-crew-members relationship.", + "operationId": "get-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identities of an individual flight's cabin-crew-members relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Adds existing flight-attendants to the cabin-crew-members relationship of an individual flight.", + "operationId": "post-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to add flight-attendants to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to add to the cabin-crew-members relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flight-attendants were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns existing flight-attendants to the cabin-crew-members relationship of an individual flight.", + "operationId": "patch-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose cabin-crew-members relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to assign to the cabin-crew-members relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The cabin-crew-members relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Removes existing flight-attendants from the cabin-crew-members relationship of an individual flight.", + "operationId": "delete-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to remove flight-attendants from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to remove from the cabin-crew-members relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flight-attendants were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/passengers": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passengers of an individual flight's passengers relationship.", + "operationId": "get-flight-passengers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passengers to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passengers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passengers of an individual flight's passengers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-passengers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passengers to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/passengers": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passenger identities of an individual flight's passengers relationship.", + "operationId": "get-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passenger identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passenger identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passenger identities of an individual flight's passengers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passenger identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Adds existing passengers to the passengers relationship of an individual flight.", + "operationId": "post-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to add passengers to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to add to the passengers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns existing passengers to the passengers relationship of an individual flight.", + "operationId": "patch-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose passengers relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to assign to the passengers relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Removes existing passengers from the passengers relationship of an individual flight.", + "operationId": "delete-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to remove passengers from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to remove from the passengers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's purser relationship.", + "operationId": "get-flight-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's purser relationship.", + "operationId": "get-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns an existing flight-attendant to the purser relationship of an individual flight.", + "operationId": "patch-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose purser relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the flight-attendant to assign to the purser relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The purser relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/passengers": { + "get": { + "tags": [ + "passengers" + ], + "summary": "Retrieves a collection of passengers.", + "operationId": "get-passenger-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passengers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "passengers" + ], + "summary": "Retrieves a collection of passengers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-passenger-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "passengers" + ], + "summary": "Creates a new passenger.", + "operationId": "post-passenger", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the passenger to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-passenger-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The passenger was successfully created, which resulted in additional changes. The newly created passenger is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created passenger can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "204": { + "description": "The passenger was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/passengers/{id}": { + "get": { + "tags": [ + "passengers" + ], + "summary": "Retrieves an individual passenger by its identifier.", + "operationId": "get-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passenger.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The passenger does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "passengers" + ], + "summary": "Retrieves an individual passenger by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The passenger does not exist." + } + } + }, + "patch": { + "tags": [ + "passengers" + ], + "summary": "Updates an existing passenger.", + "operationId": "patch-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the passenger to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-passenger-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The passenger was successfully updated, which resulted in additional changes. The updated passenger is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "204": { + "description": "The passenger was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The passenger or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "passengers" + ], + "summary": "Deletes an existing passenger by its identifier.", + "operationId": "delete-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The passenger was successfully deleted." + }, + "404": { + "description": "The passenger does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "aircraft-kind": { + "enum": [ + "Turboprops", + "LightJet", + "MidSizeJet", + "JumboJet" + ], + "type": "string" + }, + "airline": { + "enum": [ + "DeltaAirLines", + "LufthansaGroup", + "AirFranceKlm" + ], + "type": "string", + "description": "Lists the various airlines used in this API." + }, + "airplane-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-airplane-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributes-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "manufactured-at": { + "type": "string", + "description": "Gets the day on which this airplane was manufactured.", + "format": "date-time" + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/aircraft-kind" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "email-address", + "profile-image-url" + ], + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "document-number" + ], + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-create-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-create-flight-attendant-request", + "passengers": "#/components/schemas/attributes-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "attributes-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + }, + "distance-traveled-in-kilometers": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + }, + "departs-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "arrives-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "services-on-board": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "full-name": { + "type": "string", + "nullable": true + }, + "cabin-area": { + "allOf": [ + { + "$ref": "#/components/schemas/cabin-area" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-airplane-response", + "flight-attendants": "#/components/schemas/attributes-in-flight-attendant-response", + "flights": "#/components/schemas/attributes-in-flight-response", + "passengers": "#/components/schemas/attributes-in-passenger-response" + } + }, + "x-abstract": true + }, + "attributes-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-update-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-update-flight-attendant-request", + "flights": "#/components/schemas/attributes-in-update-flight-request", + "passengers": "#/components/schemas/attributes-in-update-passenger-request" + } + }, + "x-abstract": true + }, + "cabin-area": { + "enum": [ + "FirstClass", + "BusinessClass", + "EconomyClass" + ], + "type": "string" + }, + "create-airplane-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-airplane-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-flight-attendant-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-flight-attendant-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-flight-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-flight-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-passenger-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-passenger-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "data-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-airplane-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-airplane-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-airplane-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-airplane-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-flight-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-passenger-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-passenger-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-attendant-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-attendant-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-passenger-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-airplane-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-airplane-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-passenger-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-passenger-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "error-links": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-object": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-links" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/error-source" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-response-document": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-top-level-links" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error-object" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-source": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "flight-attendant-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "flight-attendant-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-resource-type": { + "enum": [ + "flight-attendants" + ], + "type": "string" + }, + "flight-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-flight-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "flight-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-resource-type": { + "enum": [ + "flights" + ], + "type": "string" + }, + "identifier-in-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "flight-attendants": "#/components/schemas/flight-attendant-identifier-in-request", + "flights": "#/components/schemas/flight-identifier-in-request", + "passengers": "#/components/schemas/passenger-identifier-in-request" + } + }, + "x-abstract": true + }, + "jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullable-flight-attendant-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-passenger-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "passenger-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/passenger-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-resource-type": { + "enum": [ + "passengers" + ], + "type": "string" + }, + "primary-airplane-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-airplane-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-flight-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-passenger-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-passenger-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationships-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "purser" + ], + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-create-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-create-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-create-flight-request" + } + }, + "x-abstract": true + }, + "relationships-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-response" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-response" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-airplane-response", + "flight-attendants": "#/components/schemas/relationships-in-flight-attendant-response", + "flights": "#/components/schemas/relationships-in-flight-response" + } + }, + "x-abstract": true + }, + "relationships-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-update-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-update-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-update-flight-request" + } + }, + "x-abstract": true + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-in-create-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-create-airplane-request", + "flight-attendants": "#/components/schemas/data-in-create-flight-attendant-request", + "flights": "#/components/schemas/data-in-create-flight-request", + "passengers": "#/components/schemas/data-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "resource-in-response": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-airplane-response", + "flight-attendants": "#/components/schemas/data-in-flight-attendant-response", + "flights": "#/components/schemas/data-in-flight-response", + "passengers": "#/components/schemas/data-in-passenger-response" + } + }, + "x-abstract": true + }, + "resource-in-update-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-update-airplane-request", + "flight-attendants": "#/components/schemas/data-in-update-flight-attendant-request", + "flights": "#/components/schemas/data-in-update-flight-request", + "passengers": "#/components/schemas/data-in-update-passenger-request" + } + }, + "x-abstract": true + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-type": { + "enum": [ + "airplanes", + "flight-attendants", + "flights", + "passengers" + ], + "type": "string" + }, + "secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-passenger-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-passenger-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-airplane-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-airplane-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-flight-attendant-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-flight-attendant-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-flight-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-flight-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-passenger-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-passenger-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/LegacyOpenApi/LegacyIntegrationDbContext.cs b/test/OpenApiTests/LegacyOpenApi/LegacyIntegrationDbContext.cs new file mode 100644 index 0000000000..e7503ed5b7 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/LegacyIntegrationDbContext.cs @@ -0,0 +1,33 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_always + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class LegacyIntegrationDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Airplanes => Set(); + public DbSet Flights => Set(); + public DbSet FlightAttendants => Set(); + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasMany(flight => flight.CabinCrewMembers) + .WithMany(flightAttendant => flightAttendant.ScheduledForFlights); + + builder.Entity() + .HasOne(flight => flight.Purser) + .WithMany(flightAttendant => flightAttendant.PurserOnFlights); + + builder.Entity() + .HasOne(flight => flight.BackupPurser) + .WithMany(); + + base.OnModelCreating(builder); + } +} diff --git a/test/OpenApiTests/LegacyOpenApi/LegacyStartup.cs b/test/OpenApiTests/LegacyOpenApi/LegacyStartup.cs new file mode 100644 index 0000000000..0888be0e1c --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/LegacyStartup.cs @@ -0,0 +1,25 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using OpenApiTests.NamingConventions.KebabCase; +using TestBuildingBlocks; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class LegacyStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.Namespace = "api"; + options.DefaultAttrCapabilities = AttrCapabilities.AllowView; + options.IncludeJsonApiVersion = true; + options.SerializerOptions.PropertyNamingPolicy = JsonKebabCaseNamingPolicy.Instance; + options.SerializerOptions.DictionaryKeyPolicy = JsonKebabCaseNamingPolicy.Instance; + options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); + } +} diff --git a/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs b/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs new file mode 100644 index 0000000000..84db211242 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/LegacyTests.cs @@ -0,0 +1,52 @@ +using System.Reflection; +using System.Resources; +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.LegacyOpenApi; + +public sealed class LegacyTests : OpenApiTestContext, LegacyIntegrationDbContext> +{ + public LegacyTests(ITestOutputHelper testOutputHelper) + { + UseController(); + UseController(); + UseController(); + UseController(); + + SetTestOutputHelper(testOutputHelper); + SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Fact] + public async Task Retrieved_swagger_document_matches_expected_document() + { + // Act + JsonElement jsonElement = await GetSwaggerDocumentAsync(); + + // Assert + string expectedJsonText = await GetExpectedSwaggerDocumentAsync(); + string actualJsonText = jsonElement.ToString(); + actualJsonText.Should().BeJson(expectedJsonText); + } + + private async Task GetExpectedSwaggerDocumentAsync() + { + string embeddedResourceName = $"{GetType().Namespace!.Replace('/', '.')}.expected-swagger.json"; + var assembly = Assembly.GetExecutingAssembly(); + + await using Stream? stream = assembly.GetManifestResourceStream(embeddedResourceName); + + if (stream == null) + { + throw new MissingManifestResourceException( + $"Failed to load embedded resource '{embeddedResourceName}'. Set Build Action to Embedded Resource in properties."); + } + + using var reader = new StreamReader(stream); + return await reader.ReadToEndAsync(); + } +} diff --git a/test/OpenApiTests/LegacyOpenApi/Passenger.cs b/test/OpenApiTests/LegacyOpenApi/Passenger.cs new file mode 100644 index 0000000000..c939562447 --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/Passenger.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.LegacyOpenApi; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.LegacyOpenApi")] +public sealed class Passenger : Identifiable +{ + [Attr(PublicName = "document-number", Capabilities = AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] + [MaxLength(9)] + public string PassportNumber { get; set; } = null!; + + [Attr] + public string? FullName { get; set; } + + [Attr] + public CabinArea CabinArea { get; set; } +} diff --git a/test/OpenApiTests/LegacyOpenApi/expected-swagger.json b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json new file mode 100644 index 0000000000..f72814347b --- /dev/null +++ b/test/OpenApiTests/LegacyOpenApi/expected-swagger.json @@ -0,0 +1,8858 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/api/airplanes": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves a collection of airplanes.", + "operationId": "get-airplane-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found airplanes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/airplane-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves a collection of airplanes without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "airplanes" + ], + "summary": "Creates a new airplane.", + "operationId": "post-airplane", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the airplane to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-airplane-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The airplane was successfully created, which resulted in additional changes. The newly created airplane is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created airplane can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "204": { + "description": "The airplane was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/airplanes/{id}": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves an individual airplane by its identifier.", + "operationId": "get-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found airplane.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves an individual airplane by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + }, + "patch": { + "tags": [ + "airplanes" + ], + "summary": "Updates an existing airplane.", + "operationId": "patch-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the airplane to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-airplane-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The airplane was successfully updated, which resulted in additional changes. The updated airplane is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-airplane-response-document" + } + } + } + }, + "204": { + "description": "The airplane was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "airplanes" + ], + "summary": "Deletes an existing airplane by its identifier.", + "operationId": "delete-airplane", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The airplane was successfully deleted." + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/airplanes/{id}/flights": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flights of an individual airplane's flights relationship.", + "operationId": "get-airplane-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flights of an individual airplane's flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + } + }, + "/api/airplanes/{id}/relationships/flights": { + "get": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flight identities of an individual airplane's flights relationship.", + "operationId": "get-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "airplanes" + ], + "summary": "Retrieves the related flight identities of an individual airplane's flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The airplane does not exist." + } + } + }, + "post": { + "tags": [ + "airplanes" + ], + "summary": "Adds existing flights to the flights relationship of an individual airplane.", + "operationId": "post-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "airplanes" + ], + "summary": "Assigns existing flights to the flights relationship of an individual airplane.", + "operationId": "patch-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane whose flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "airplanes" + ], + "summary": "Removes existing flights from the flights relationship of an individual airplane.", + "operationId": "delete-airplane-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the airplane to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The airplane or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves a collection of flight-attendants.", + "operationId": "get-flight-attendant-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendants, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves a collection of flight-attendants without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Creates a new flight-attendant.", + "operationId": "post-flight-attendant", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight-attendant to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-flight-attendant-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The flight-attendant was successfully created, which resulted in additional changes. The newly created flight-attendant is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created flight-attendant can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "204": { + "description": "The flight-attendant was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves an individual flight-attendant by its identifier.", + "operationId": "get-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves an individual flight-attendant by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Updates an existing flight-attendant.", + "operationId": "patch-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight-attendant to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-flight-attendant-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The flight-attendant was successfully updated, which resulted in additional changes. The updated flight-attendant is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-attendant-response-document" + } + } + } + }, + "204": { + "description": "The flight-attendant was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Deletes an existing flight-attendant by its identifier.", + "operationId": "delete-flight-attendant", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The flight-attendant was successfully deleted." + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}/purser-on-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's purser-on-flights relationship.", + "operationId": "get-flight-attendant-purser-on-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's purser-on-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-purser-on-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + } + }, + "/api/flight-attendants/{id}/relationships/purser-on-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's purser-on-flights relationship.", + "operationId": "get-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's purser-on-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Adds existing flights to the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "post-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the purser-on-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Assigns existing flights to the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "patch-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose purser-on-flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the purser-on-flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The purser-on-flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Removes existing flights from the purser-on-flights relationship of an individual flight-attendant.", + "operationId": "delete-flight-attendant-purser-on-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the purser-on-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flight-attendants/{id}/scheduled-for-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's scheduled-for-flights relationship.", + "operationId": "get-flight-attendant-scheduled-for-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flights of an individual flight-attendant's scheduled-for-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-scheduled-for-flights", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flights to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + } + }, + "/api/flight-attendants/{id}/relationships/scheduled-for-flights": { + "get": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's scheduled-for-flights relationship.", + "operationId": "get-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flight-attendants" + ], + "summary": "Retrieves the related flight identities of an individual flight-attendant's scheduled-for-flights relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose related flight identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight-attendant does not exist." + } + } + }, + "post": { + "tags": [ + "flight-attendants" + ], + "summary": "Adds existing flights to the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "post-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to add flights to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to add to the scheduled-for-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flight-attendants" + ], + "summary": "Assigns existing flights to the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "patch-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant whose scheduled-for-flights relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to assign to the scheduled-for-flights relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The scheduled-for-flights relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flight-attendants" + ], + "summary": "Removes existing flights from the scheduled-for-flights relationship of an individual flight-attendant.", + "operationId": "delete-flight-attendant-scheduled-for-flights-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight-attendant to remove flights from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flights to remove from the scheduled-for-flights relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flights were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight-attendant or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves a collection of flights.", + "operationId": "get-flight-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flights, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves a collection of flights without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Creates a new flight.", + "operationId": "post-flight", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-flight-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The flight was successfully created, which resulted in additional changes. The newly created flight is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created flight can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "204": { + "description": "The flight was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves an individual flight by its identifier.", + "operationId": "get-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves an individual flight by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Updates an existing flight.", + "operationId": "patch-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the flight to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-flight-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The flight was successfully updated, which resulted in additional changes. The updated flight is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-flight-response-document" + } + } + } + }, + "204": { + "description": "The flight was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Deletes an existing flight by its identifier.", + "operationId": "delete-flight", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The flight was successfully deleted." + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/backup-purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's backup-purser relationship.", + "operationId": "get-flight-backup-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-secondary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's backup-purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-backup-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/backup-purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's backup-purser relationship.", + "operationId": "get-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-flight-attendant-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's backup-purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Clears or assigns an existing flight-attendant to the backup-purser relationship of an individual flight.", + "operationId": "patch-flight-backup-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose backup-purser relationship to assign or clear.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the flight-attendant to assign to the backup-purser relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The backup-purser relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/cabin-crew-members": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendants of an individual flight's cabin-crew-members relationship.", + "operationId": "get-flight-cabin-crew-members", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendants to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendants, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendants of an individual flight's cabin-crew-members relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-cabin-crew-members", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendants to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/cabin-crew-members": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identities of an individual flight's cabin-crew-members relationship.", + "operationId": "get-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identities of an individual flight's cabin-crew-members relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Adds existing flight-attendants to the cabin-crew-members relationship of an individual flight.", + "operationId": "post-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to add flight-attendants to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to add to the cabin-crew-members relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flight-attendants were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns existing flight-attendants to the cabin-crew-members relationship of an individual flight.", + "operationId": "patch-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose cabin-crew-members relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to assign to the cabin-crew-members relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The cabin-crew-members relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Removes existing flight-attendants from the cabin-crew-members relationship of an individual flight.", + "operationId": "delete-flight-cabin-crew-members-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to remove flight-attendants from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the flight-attendants to remove from the cabin-crew-members relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The flight-attendants were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/passengers": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passengers of an individual flight's passengers relationship.", + "operationId": "get-flight-passengers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passengers to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passengers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passengers of an individual flight's passengers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-passengers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passengers to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/passengers": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passenger identities of an individual flight's passengers relationship.", + "operationId": "get-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passenger identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passenger identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related passenger identities of an individual flight's passengers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related passenger identities to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "post": { + "tags": [ + "flights" + ], + "summary": "Adds existing passengers to the passengers relationship of an individual flight.", + "operationId": "post-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to add passengers to.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to add to the passengers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns existing passengers to the passengers relationship of an individual flight.", + "operationId": "patch-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose passengers relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to assign to the passengers relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "flights" + ], + "summary": "Removes existing passengers from the passengers relationship of an individual flight.", + "operationId": "delete-flight-passengers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight to remove passengers from.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identities of the passengers to remove from the passengers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The passengers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/flights/{id}/purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's purser relationship.", + "operationId": "get-flight-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondary-flight-attendant-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant of an individual flight's purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-purser", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + } + }, + "/api/flights/{id}/relationships/purser": { + "get": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's purser relationship.", + "operationId": "get-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found flight-attendant identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/flight-attendant-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "flights" + ], + "summary": "Retrieves the related flight-attendant identity of an individual flight's purser relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose related flight-attendant identity to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The flight does not exist." + } + } + }, + "patch": { + "tags": [ + "flights" + ], + "summary": "Assigns an existing flight-attendant to the purser relationship of an individual flight.", + "operationId": "patch-flight-purser-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the flight whose purser relationship to assign.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "The identity of the flight-attendant to assign to the purser relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The purser relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The flight or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/passengers": { + "get": { + "tags": [ + "passengers" + ], + "summary": "Retrieves a collection of passengers.", + "operationId": "get-passenger-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passengers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/passenger-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "passengers" + ], + "summary": "Retrieves a collection of passengers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-passenger-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "passengers" + ], + "summary": "Creates a new passenger.", + "operationId": "post-passenger", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the passenger to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-passenger-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The passenger was successfully created, which resulted in additional changes. The newly created passenger is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created passenger can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "204": { + "description": "The passenger was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/api/passengers/{id}": { + "get": { + "tags": [ + "passengers" + ], + "summary": "Retrieves an individual passenger by its identifier.", + "operationId": "get-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found passenger.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The passenger does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "passengers" + ], + "summary": "Retrieves an individual passenger by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to retrieve.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The passenger does not exist." + } + } + }, + "patch": { + "tags": [ + "passengers" + ], + "summary": "Updates an existing passenger.", + "operationId": "patch-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to update.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the passenger to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-passenger-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The passenger was successfully updated, which resulted in additional changes. The updated passenger is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-passenger-response-document" + } + } + } + }, + "204": { + "description": "The passenger was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The passenger or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "passengers" + ], + "summary": "Deletes an existing passenger by its identifier.", + "operationId": "delete-passenger", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the passenger to delete.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The passenger was successfully deleted." + }, + "404": { + "description": "The passenger does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "aircraft-kind": { + "enum": [ + "Turboprops", + "LightJet", + "MidSizeJet", + "JumboJet" + ], + "type": "string" + }, + "airline": { + "enum": [ + "DeltaAirLines", + "LufthansaGroup", + "AirFranceKlm" + ], + "type": "string", + "description": "Lists the various airlines used in this API." + }, + "airplane-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-airplane-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributes-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "manufactured-at": { + "type": "string", + "description": "Gets the day on which this airplane was manufactured.", + "format": "date-time" + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/aircraft-kind" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "email-address", + "profile-image-url" + ], + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "document-number" + ], + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-create-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-create-flight-attendant-request", + "passengers": "#/components/schemas/attributes-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "attributes-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + }, + "profile-image-url": { + "type": "string", + "format": "uri" + }, + "distance-traveled-in-kilometers": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + }, + "departs-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "arrives-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "services-on-board": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "full-name": { + "type": "string", + "nullable": true + }, + "cabin-area": { + "allOf": [ + { + "$ref": "#/components/schemas/cabin-area" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-airplane-response", + "flight-attendants": "#/components/schemas/attributes-in-flight-attendant-response", + "flights": "#/components/schemas/attributes-in-flight-response", + "passengers": "#/components/schemas/attributes-in-passenger-response" + } + }, + "x-abstract": true + }, + "attributes-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name": { + "maxLength": 255, + "type": "string" + }, + "serial-number": { + "maxLength": 16, + "type": "string", + "nullable": true + }, + "airtime-in-hours": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "last-serviced-at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is-in-maintenance": { + "type": "boolean" + }, + "manufactured-in-city": { + "maxLength": 85, + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "email-address": { + "minLength": 1, + "type": "string", + "format": "email" + }, + "age": { + "maximum": 75, + "minimum": 18, + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "final-destination": { + "maxLength": 40, + "type": "string" + }, + "stop-over-destination": { + "maxLength": 2000, + "type": "string", + "nullable": true + }, + "operated-by": { + "allOf": [ + { + "$ref": "#/components/schemas/airline" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-passenger-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "document-number": { + "maxLength": 9, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/attributes-in-update-airplane-request", + "flight-attendants": "#/components/schemas/attributes-in-update-flight-attendant-request", + "flights": "#/components/schemas/attributes-in-update-flight-request", + "passengers": "#/components/schemas/attributes-in-update-passenger-request" + } + }, + "x-abstract": true + }, + "cabin-area": { + "enum": [ + "FirstClass", + "BusinessClass", + "EconomyClass" + ], + "type": "string" + }, + "create-airplane-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-airplane-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-flight-attendant-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-flight-attendant-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-flight-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-flight-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-passenger-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-passenger-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "data-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-airplane-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-airplane-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-airplane-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-airplane-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-attendant-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-flight-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-flight-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-passenger-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-passenger-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-attendant-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-attendant-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-flight-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-flight-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-passenger-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-passenger-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-airplane-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-airplane-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-airplane-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-attendant-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-attendant-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-attendant-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-flight-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-flight-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-flight-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-passenger-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-passenger-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "error-links": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-object": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-links" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/error-source" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-response-document": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-top-level-links" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error-object" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-source": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "flight-attendant-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "flight-attendant-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-attendant-resource-type": { + "enum": [ + "flight-attendants" + ], + "type": "string" + }, + "flight-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-flight-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "flight-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "flight-resource-type": { + "enum": [ + "flights" + ], + "type": "string" + }, + "identifier-in-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "flight-attendants": "#/components/schemas/flight-attendant-identifier-in-request", + "flights": "#/components/schemas/flight-identifier-in-request", + "passengers": "#/components/schemas/passenger-identifier-in-request" + } + }, + "x-abstract": true + }, + "jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullable-flight-attendant-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-passenger-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "passenger-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/passenger-resource-type" + } + ] + }, + "id": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "passenger-resource-type": { + "enum": [ + "passengers" + ], + "type": "string" + }, + "primary-airplane-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-airplane-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-flight-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-passenger-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-passenger-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationships-in-airplane-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "purser" + ], + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-create-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-create-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-create-flight-request" + } + }, + "x-abstract": true + }, + "relationships-in-flight-attendant-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-flight-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-response" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-response" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-response" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-airplane-response", + "flight-attendants": "#/components/schemas/relationships-in-flight-attendant-response", + "flights": "#/components/schemas/relationships-in-flight-response" + } + }, + "x-abstract": true + }, + "relationships-in-update-airplane-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-flight-attendant-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "scheduled-for-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + }, + "purser-on-flights": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-flight-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "cabin-crew-members": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-flight-attendant-in-request" + } + ] + }, + "purser": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-flight-attendant-in-request" + } + ] + }, + "backup-purser": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-flight-attendant-in-request" + } + ] + }, + "passengers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-passenger-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "airplanes": "#/components/schemas/relationships-in-update-airplane-request", + "flight-attendants": "#/components/schemas/relationships-in-update-flight-attendant-request", + "flights": "#/components/schemas/relationships-in-update-flight-request" + } + }, + "x-abstract": true + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-in-create-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-create-airplane-request", + "flight-attendants": "#/components/schemas/data-in-create-flight-attendant-request", + "flights": "#/components/schemas/data-in-create-flight-request", + "passengers": "#/components/schemas/data-in-create-passenger-request" + } + }, + "x-abstract": true + }, + "resource-in-response": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-airplane-response", + "flight-attendants": "#/components/schemas/data-in-flight-attendant-response", + "flights": "#/components/schemas/data-in-flight-response", + "passengers": "#/components/schemas/data-in-passenger-response" + } + }, + "x-abstract": true + }, + "resource-in-update-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "airplanes": "#/components/schemas/data-in-update-airplane-request", + "flight-attendants": "#/components/schemas/data-in-update-flight-attendant-request", + "flights": "#/components/schemas/data-in-update-flight-request", + "passengers": "#/components/schemas/data-in-update-passenger-request" + } + }, + "x-abstract": true + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-type": { + "enum": [ + "airplanes", + "flight-attendants", + "flights", + "passengers" + ], + "type": "string" + }, + "secondary-flight-attendant-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-flight-attendant-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-flight-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/flight-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-passenger-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-passenger-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/passenger-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-flight-attendant-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-flight-attendant-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/flight-attendant-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-airplane-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-airplane-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-flight-attendant-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-flight-attendant-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-flight-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-flight-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-passenger-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-passenger-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/Links/Accommodation.cs b/test/OpenApiTests/Links/Accommodation.cs new file mode 100644 index 0000000000..5a793da701 --- /dev/null +++ b/test/OpenApiTests/Links/Accommodation.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Accommodation : Identifiable +{ + [Attr] + public string Address { get; set; } = null!; +} diff --git a/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs new file mode 100644 index 0000000000..c236ef9b61 --- /dev/null +++ b/test/OpenApiTests/Links/Disabled/LinksDisabledTests.cs @@ -0,0 +1,120 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.Links.Disabled; + +public sealed class LinksDisabledTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksDisabledTests(OpenApiTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + + var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); + options.TopLevelLinks = LinkTypes.None; + options.ResourceLinks = LinkTypes.NotConfigured; + options.RelationshipLinks = LinkTypes.None; + } + + [Theory] + [InlineData("resourceTopLevelLinks")] + [InlineData("resourceCollectionTopLevelLinks")] + [InlineData("resourceIdentifierTopLevelLinks")] + [InlineData("resourceIdentifierCollectionTopLevelLinks")] + [InlineData("errorTopLevelLinks")] + [InlineData("relationshipLinks")] + [InlineData("resourceLinks")] + public async Task All_configurable_link_schemas_are_hidden(string schemaId) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().NotContainPath(schemaId); + }); + } + + [Fact] + public async Task Error_links_schema_is_visible() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.errorLinks").With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.Should().HaveCount(2); + linkPropertyNames[0].Should().Be("about"); + linkPropertyNames[1].Should().Be("type"); + }); + }); + } + + [Theory] + [InlineData("primaryAccommodationResponseDocument")] + [InlineData("secondaryAccommodationResponseDocument")] + [InlineData("primaryExcursionResponseDocument")] + [InlineData("primaryTransportResponseDocument")] + [InlineData("nullableSecondaryTransportResponseDocument")] + [InlineData("primaryVacationResponseDocument")] + [InlineData("accommodationCollectionResponseDocument")] + [InlineData("excursionCollectionResponseDocument")] + [InlineData("transportCollectionResponseDocument")] + [InlineData("vacationCollectionResponseDocument")] + [InlineData("accommodationIdentifierResponseDocument")] + [InlineData("nullableTransportIdentifierResponseDocument")] + [InlineData("excursionIdentifierCollectionResponseDocument")] + [InlineData("errorResponseDocument")] + [InlineData("toOneAccommodationInResponse")] + [InlineData("toManyExcursionInResponse")] + [InlineData("nullableToOneTransportInResponse")] + [InlineData("dataInAccommodationResponse.allOf[1]")] + [InlineData("dataInExcursionResponse.allOf[1]")] + [InlineData("dataInTransportResponse.allOf[1]")] + [InlineData("dataInVacationResponse.allOf[1]")] + public async Task All_container_schemas_contain_no_link_property(string containerSchemaId) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(containerSchemaId).With(containerElement => + { + if (containerElement.TryGetProperty("required", out JsonElement requiredElement)) + { + requiredElement.Should().NotContainArrayElement("links"); + } + else + { + containerElement.Should().NotContainPath("required"); + } + + containerElement.Should().NotContainPath("properties.links"); + }); + }); + } +} diff --git a/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..b72c15aecb --- /dev/null +++ b/test/OpenApiTests/Links/Enabled/GeneratedSwagger/swagger.g.json @@ -0,0 +1,6013 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/accommodations": { + "get": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves a collection of accommodations.", + "operationId": "getAccommodationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodations, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/accommodationCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves a collection of accommodations without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headAccommodationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "accommodations" + ], + "summary": "Creates a new accommodation.", + "operationId": "postAccommodation", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the accommodation to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createAccommodationRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The accommodation was successfully created, which resulted in additional changes. The newly created accommodation is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created accommodation can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" + } + } + } + }, + "204": { + "description": "The accommodation was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/accommodations/{id}": { + "get": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves an individual accommodation by its identifier.", + "operationId": "getAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The accommodation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "accommodations" + ], + "summary": "Retrieves an individual accommodation by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The accommodation does not exist." + } + } + }, + "patch": { + "tags": [ + "accommodations" + ], + "summary": "Updates an existing accommodation.", + "operationId": "patchAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the accommodation to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateAccommodationRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The accommodation was successfully updated, which resulted in additional changes. The updated accommodation is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryAccommodationResponseDocument" + } + } + } + }, + "204": { + "description": "The accommodation was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The accommodation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "accommodations" + ], + "summary": "Deletes an existing accommodation by its identifier.", + "operationId": "deleteAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the accommodation to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The accommodation was successfully deleted." + }, + "404": { + "description": "The accommodation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/excursions": { + "get": { + "tags": [ + "excursions" + ], + "summary": "Retrieves a collection of excursions.", + "operationId": "getExcursionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/excursionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "excursions" + ], + "summary": "Retrieves a collection of excursions without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headExcursionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "excursions" + ], + "summary": "Creates a new excursion.", + "operationId": "postExcursion", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the excursion to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createExcursionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The excursion was successfully created, which resulted in additional changes. The newly created excursion is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created excursion can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryExcursionResponseDocument" + } + } + } + }, + "204": { + "description": "The excursion was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/excursions/{id}": { + "get": { + "tags": [ + "excursions" + ], + "summary": "Retrieves an individual excursion by its identifier.", + "operationId": "getExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursion.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryExcursionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The excursion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "excursions" + ], + "summary": "Retrieves an individual excursion by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The excursion does not exist." + } + } + }, + "patch": { + "tags": [ + "excursions" + ], + "summary": "Updates an existing excursion.", + "operationId": "patchExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the excursion to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateExcursionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The excursion was successfully updated, which resulted in additional changes. The updated excursion is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryExcursionResponseDocument" + } + } + } + }, + "204": { + "description": "The excursion was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The excursion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "excursions" + ], + "summary": "Deletes an existing excursion by its identifier.", + "operationId": "deleteExcursion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the excursion to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The excursion was successfully deleted." + }, + "404": { + "description": "The excursion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/transports": { + "get": { + "tags": [ + "transports" + ], + "summary": "Retrieves a collection of transports.", + "operationId": "getTransportCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transports, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/transportCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "transports" + ], + "summary": "Retrieves a collection of transports without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTransportCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "transports" + ], + "summary": "Creates a new transport.", + "operationId": "postTransport", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the transport to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createTransportRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The transport was successfully created, which resulted in additional changes. The newly created transport is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created transport can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTransportResponseDocument" + } + } + } + }, + "204": { + "description": "The transport was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/transports/{id}": { + "get": { + "tags": [ + "transports" + ], + "summary": "Retrieves an individual transport by its identifier.", + "operationId": "getTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTransportResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The transport does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "transports" + ], + "summary": "Retrieves an individual transport by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The transport does not exist." + } + } + }, + "patch": { + "tags": [ + "transports" + ], + "summary": "Updates an existing transport.", + "operationId": "patchTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the transport to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateTransportRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The transport was successfully updated, which resulted in additional changes. The updated transport is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryTransportResponseDocument" + } + } + } + }, + "204": { + "description": "The transport was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The transport or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "transports" + ], + "summary": "Deletes an existing transport by its identifier.", + "operationId": "deleteTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the transport to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The transport was successfully deleted." + }, + "404": { + "description": "The transport does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves a collection of vacations.", + "operationId": "getVacationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found vacations, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/vacationCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves a collection of vacations without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "vacations" + ], + "summary": "Creates a new vacation.", + "operationId": "postVacation", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the vacation to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createVacationRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The vacation was successfully created, which resulted in additional changes. The newly created vacation is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created vacation can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryVacationResponseDocument" + } + } + } + }, + "204": { + "description": "The vacation was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves an individual vacation by its identifier.", + "operationId": "getVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found vacation.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryVacationResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves an individual vacation by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Updates an existing vacation.", + "operationId": "patchVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the vacation to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateVacationRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The vacation was successfully updated, which resulted in additional changes. The updated vacation is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryVacationResponseDocument" + } + } + } + }, + "204": { + "description": "The vacation was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "vacations" + ], + "summary": "Deletes an existing vacation by its identifier.", + "operationId": "deleteVacation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The vacation was successfully deleted." + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/accommodation": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation of an individual vacation's accommodation relationship.", + "operationId": "getVacationAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryAccommodationResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation of an individual vacation's accommodation relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationAccommodation", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/accommodation": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation identity of an individual vacation's accommodation relationship.", + "operationId": "getVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found accommodation identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/accommodationIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related accommodation identity of an individual vacation's accommodation relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related accommodation identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Assigns an existing accommodation to the accommodation relationship of an individual vacation.", + "operationId": "patchVacationAccommodationRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose accommodation relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the accommodation to assign to the accommodation relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The accommodation relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/excursions": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursions of an individual vacation's excursions relationship.", + "operationId": "getVacationExcursions", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursions to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/excursionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursions of an individual vacation's excursions relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationExcursions", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursions to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/excursions": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursion identities of an individual vacation's excursions relationship.", + "operationId": "getVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursion identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found excursion identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/excursionIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related excursion identities of an individual vacation's excursions relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related excursion identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "post": { + "tags": [ + "vacations" + ], + "summary": "Adds existing excursions to the excursions relationship of an individual vacation.", + "operationId": "postVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to add excursions to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to add to the excursions relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Assigns existing excursions to the excursions relationship of an individual vacation.", + "operationId": "patchVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose excursions relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to assign to the excursions relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "vacations" + ], + "summary": "Removes existing excursions from the excursions relationship of an individual vacation.", + "operationId": "deleteVacationExcursionsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation to remove excursions from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the excursions to remove from the excursions relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The excursions were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/vacations/{id}/transport": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport of an individual vacation's transport relationship.", + "operationId": "getVacationTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryTransportResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport of an individual vacation's transport relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationTransport", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + } + }, + "/vacations/{id}/relationships/transport": { + "get": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport identity of an individual vacation's transport relationship.", + "operationId": "getVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found transport identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableTransportIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "vacations" + ], + "summary": "Retrieves the related transport identity of an individual vacation's transport relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose related transport identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The vacation does not exist." + } + } + }, + "patch": { + "tags": [ + "vacations" + ], + "summary": "Clears or assigns an existing transport to the transport relationship of an individual vacation.", + "operationId": "patchVacationTransportRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the vacation whose transport relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the transport to assign to the transport relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The transport relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The vacation or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "accommodationCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInAccommodationResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "accommodationIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "accommodationResourceType": { + "enum": [ + "accommodations" + ], + "type": "string" + }, + "attributesInAccommodationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateAccommodationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "address" + ], + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateExcursionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "description", + "occursAt" + ], + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInCreateAccommodationRequest", + "excursions": "#/components/schemas/attributesInCreateExcursionRequest", + "transports": "#/components/schemas/attributesInCreateTransportRequest", + "vacations": "#/components/schemas/attributesInCreateVacationRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateTransportRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "durationInMinutes", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "endsAt", + "startsAt" + ], + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInExcursionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInAccommodationResponse", + "excursions": "#/components/schemas/attributesInExcursionResponse", + "transports": "#/components/schemas/attributesInTransportResponse", + "vacations": "#/components/schemas/attributesInVacationResponse" + } + }, + "x-abstract": true + }, + "attributesInTransportResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateAccommodationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateExcursionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "occursAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "accommodations": "#/components/schemas/attributesInUpdateAccommodationRequest", + "excursions": "#/components/schemas/attributesInUpdateExcursionRequest", + "transports": "#/components/schemas/attributesInUpdateTransportRequest", + "vacations": "#/components/schemas/attributesInUpdateVacationRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateTransportRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportType" + } + ] + }, + "durationInMinutes": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "format": "date-time" + }, + "endsAt": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createAccommodationRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateAccommodationRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createExcursionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateExcursionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createTransportRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateTransportRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createVacationRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateVacationRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInAccommodationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInAccommodationResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateAccommodationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateAccommodationRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateExcursionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateExcursionRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateTransportRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateTransportRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateVacationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateVacationRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateVacationRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInExcursionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInExcursionResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInTransportResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInTransportResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateAccommodationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateAccommodationRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateExcursionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateExcursionRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateTransportRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateTransportRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateVacationRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateVacationRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateVacationRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInVacationResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInVacationResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "excursionCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInExcursionResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "excursionIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "excursionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "excursionIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/excursionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "excursionResourceType": { + "enum": [ + "excursions" + ], + "type": "string" + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/accommodationIdentifierInRequest", + "excursions": "#/components/schemas/excursionIdentifierInRequest", + "transports": "#/components/schemas/transportIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableSecondaryTransportResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInTransportResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneTransportInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneTransportInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableTransportIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/transportIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryAccommodationResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInAccommodationResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryExcursionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInExcursionResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryTransportResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInTransportResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryVacationResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInVacationResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInCreateVacationRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "accommodation" + ], + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInVacationResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "vacations": "#/components/schemas/relationshipsInUpdateVacationRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateVacationRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInRequest" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInRequest" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInVacationResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "accommodation": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneAccommodationInResponse" + } + ] + }, + "transport": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneTransportInResponse" + } + ] + }, + "excursions": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyExcursionInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInCreateAccommodationRequest", + "excursions": "#/components/schemas/dataInCreateExcursionRequest", + "transports": "#/components/schemas/dataInCreateTransportRequest", + "vacations": "#/components/schemas/dataInCreateVacationRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInAccommodationResponse", + "excursions": "#/components/schemas/dataInExcursionResponse", + "transports": "#/components/schemas/dataInTransportResponse", + "vacations": "#/components/schemas/dataInVacationResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "accommodations": "#/components/schemas/dataInUpdateAccommodationRequest", + "excursions": "#/components/schemas/dataInUpdateExcursionRequest", + "transports": "#/components/schemas/dataInUpdateTransportRequest", + "vacations": "#/components/schemas/dataInUpdateVacationRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "accommodations", + "excursions", + "transports", + "vacations" + ], + "type": "string" + }, + "secondaryAccommodationResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInAccommodationResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyExcursionInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyExcursionInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/excursionIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneAccommodationInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneAccommodationInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/accommodationIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "transportCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInTransportResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "transportIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "transportIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/transportResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "transportResourceType": { + "enum": [ + "transports" + ], + "type": "string" + }, + "transportType": { + "enum": [ + 0, + 1, + 2, + 3 + ], + "type": "integer", + "format": "int32" + }, + "updateAccommodationRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateAccommodationRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateExcursionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateExcursionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateTransportRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateTransportRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateVacationRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateVacationRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "vacationCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInVacationResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs new file mode 100644 index 0000000000..ba476b5756 --- /dev/null +++ b/test/OpenApiTests/Links/Enabled/LinksEnabledTests.cs @@ -0,0 +1,113 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Resources.Annotations; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.Links.Enabled; + +public sealed class LinksEnabledTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksEnabledTests(OpenApiTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("resourceTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy)] + [InlineData("resourceCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy | LinkTypes.Pagination)] + [InlineData("resourceIdentifierTopLevelLinks", LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.Related | LinkTypes.DescribedBy | LinkTypes.Pagination)] + [InlineData("errorTopLevelLinks", LinkTypes.Self | LinkTypes.DescribedBy)] + [InlineData("relationshipLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceLinks", LinkTypes.Self)] + public async Task All_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(schemaId).With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] propertyNamesExpected = expected.ToPropertyNames().ToArray(); + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.Should().BeEquivalentTo(propertyNamesExpected); + }); + }); + }); + } + + [Theory] + [InlineData("resourceTopLevelLinks", "primaryAccommodationResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "secondaryAccommodationResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryExcursionResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryTransportResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "nullableSecondaryTransportResponseDocument", true)] + [InlineData("resourceTopLevelLinks", "primaryVacationResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "accommodationCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "excursionCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "transportCollectionResponseDocument", true)] + [InlineData("resourceCollectionTopLevelLinks", "vacationCollectionResponseDocument", true)] + [InlineData("resourceIdentifierTopLevelLinks", "accommodationIdentifierResponseDocument", true)] + [InlineData("resourceIdentifierTopLevelLinks", "nullableTransportIdentifierResponseDocument", true)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", "excursionIdentifierCollectionResponseDocument", true)] + [InlineData("errorTopLevelLinks", "errorResponseDocument", true)] + [InlineData("relationshipLinks", "toOneAccommodationInResponse", false)] + [InlineData("relationshipLinks", "toManyExcursionInResponse", false)] + [InlineData("relationshipLinks", "nullableToOneTransportInResponse", false)] + [InlineData("resourceLinks", "dataInAccommodationResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInExcursionResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInTransportResponse.allOf[1]", false)] + [InlineData("resourceLinks", "dataInVacationResponse.allOf[1]", false)] + public async Task All_container_schemas_contain_correct_link_property(string linkSchemaId, string containerSchemaId, bool isRequired) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(containerSchemaId).With(containerElement => + { + if (isRequired) + { + containerElement.Should().ContainPath("required").With(requiredElement => + { + requiredElement.Should().ContainArrayElement("links"); + }); + } + else + { + if (containerElement.TryGetProperty("required", out JsonElement requiredElement)) + { + requiredElement.Should().NotContainArrayElement("links"); + } + else + { + containerElement.Should().NotContainPath("required"); + } + } + + containerElement.Should().ContainPath("properties.links.allOf[0].$ref").ShouldBeSchemaReferenceId(linkSchemaId); + }); + }); + } +} diff --git a/test/OpenApiTests/Links/Excursion.cs b/test/OpenApiTests/Links/Excursion.cs new file mode 100644 index 0000000000..92143cab73 --- /dev/null +++ b/test/OpenApiTests/Links/Excursion.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Excursion : Identifiable +{ + [Attr] + [Required] + public DateTime? OccursAt { get; set; } + + [Attr] + public string Description { get; set; } = null!; +} diff --git a/test/OpenApiTests/Links/LinkDbContext.cs b/test/OpenApiTests/Links/LinkDbContext.cs new file mode 100644 index 0000000000..c12d04c0c0 --- /dev/null +++ b/test/OpenApiTests/Links/LinkDbContext.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class LinkDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Vacations => Set(); + public DbSet Accommodations => Set(); + public DbSet Transports => Set(); + public DbSet Excursions => Set(); +} diff --git a/test/OpenApiTests/Links/LinkFakers.cs b/test/OpenApiTests/Links/LinkFakers.cs new file mode 100644 index 0000000000..92e4a093f0 --- /dev/null +++ b/test/OpenApiTests/Links/LinkFakers.cs @@ -0,0 +1,36 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class LinkFakers +{ + private readonly Lazy> _lazyVacationFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(vacation => vacation.StartsAt, faker => faker.Date.Future()) + .RuleFor(vacation => vacation.EndsAt, faker => faker.Date.Future())); + + private readonly Lazy> _lazyAccommodationFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(accommodation => accommodation.Address, faker => faker.Address.FullAddress())); + + private readonly Lazy> _lazyTransportFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(transport => transport.Type, faker => faker.PickRandom()) + .RuleFor(transport => transport.DurationInMinutes, faker => faker.Random.Int(30, 24 * 60))); + + private readonly Lazy> _lazyExcursionFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(excursion => excursion.OccursAt, faker => faker.Date.Future()) + .RuleFor(excursion => excursion.Description, faker => faker.Lorem.Sentence())); + + public Faker Vacation => _lazyVacationFaker.Value; + public Faker Accommodation => _lazyAccommodationFaker.Value; + public Faker Transport => _lazyTransportFaker.Value; + public Faker Excursion => _lazyExcursionFaker.Value; +} diff --git a/test/OpenApiTests/Links/LinkTypesExtensions.cs b/test/OpenApiTests/Links/LinkTypesExtensions.cs new file mode 100644 index 0000000000..192590b692 --- /dev/null +++ b/test/OpenApiTests/Links/LinkTypesExtensions.cs @@ -0,0 +1,32 @@ +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +internal static class LinkTypesExtensions +{ + public static IEnumerable ToPropertyNames(this LinkTypes linkTypes) + { + if (linkTypes.HasFlag(LinkTypes.Self)) + { + yield return "self"; + } + + if (linkTypes.HasFlag(LinkTypes.Related)) + { + yield return "related"; + } + + if (linkTypes.HasFlag(LinkTypes.DescribedBy)) + { + yield return "describedby"; + } + + if (linkTypes.HasFlag(LinkTypes.Pagination)) + { + yield return "first"; + yield return "last"; + yield return "prev"; + yield return "next"; + } + } +} diff --git a/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs new file mode 100644 index 0000000000..3a6be9dc32 --- /dev/null +++ b/test/OpenApiTests/Links/Mixed/LinksMixedTests.cs @@ -0,0 +1,96 @@ +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.Links.Mixed; + +public sealed class LinksMixedTests : IClassFixture, LinkDbContext>> +{ + private readonly OpenApiTestContext, LinkDbContext> _testContext; + + public LinksMixedTests(OpenApiTestContext, LinkDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.ConfigureServices(services => services.AddSingleton(CreateResourceGraph)); + + var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService(); + options.TopLevelLinks = LinkTypes.Pagination; + options.ResourceLinks = LinkTypes.NotConfigured; + options.RelationshipLinks = LinkTypes.None; + } + + [Theory] + [InlineData("resourceTopLevelLinks", LinkTypes.Self)] + [InlineData("resourceCollectionTopLevelLinks", LinkTypes.Self)] + [InlineData("resourceIdentifierTopLevelLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceIdentifierCollectionTopLevelLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("errorTopLevelLinks", LinkTypes.Self)] + [InlineData("relationshipLinks", LinkTypes.Self | LinkTypes.Related)] + [InlineData("resourceLinks", LinkTypes.Self)] + public async Task Expected_configurable_link_schemas_are_exposed(string schemaId, LinkTypes expected) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath(schemaId).With(linksElement => + { + linksElement.Should().NotContainPath("required"); + + linksElement.Should().ContainPath("properties").With(propertiesElement => + { + string[] propertyNamesExpected = expected.ToPropertyNames().ToArray(); + string[] linkPropertyNames = propertiesElement.EnumerateObject().Select(propertyElement => propertyElement.Name).ToArray(); + + linkPropertyNames.Should().BeEquivalentTo(propertyNamesExpected); + }); + }); + }); + } + + private static IResourceGraph CreateResourceGraph(IServiceProvider serviceProvider) + { + ResourceGraphBuilder builder = CreateResourceGraphBuilder(serviceProvider); + var editor = new ResourceGraphEditor(builder); + + editor.ChangeLinksInResourceType(typeof(Vacation), LinkTypes.None, null, null); + editor.ChangeLinkInRelationship(typeof(Vacation), nameof(Vacation.Transport), LinkTypes.Related); + + editor.ChangeLinksInResourceType(typeof(Accommodation), LinkTypes.Self, LinkTypes.Self, null); + + editor.ChangeLinksInResourceType(typeof(Transport), LinkTypes.Related, LinkTypes.Self, LinkTypes.Self); + + editor.ChangeLinksInResourceType(typeof(Excursion), LinkTypes.None, null, LinkTypes.None); + + return editor.GetResourceGraph(); + } + + private static ResourceGraphBuilder CreateResourceGraphBuilder(IServiceProvider serviceProvider) + { + var options = serviceProvider.GetRequiredService(); + var loggerFactory = serviceProvider.GetRequiredService(); + + using IServiceScope scope = serviceProvider.CreateScope(); + var dbContext = scope.ServiceProvider.GetRequiredService(); + + var builder = new ResourceGraphBuilder(options, loggerFactory); + builder.Add(dbContext); + + return builder; + } +} diff --git a/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs b/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs new file mode 100644 index 0000000000..5a2f19cfa7 --- /dev/null +++ b/test/OpenApiTests/Links/Mixed/ResourceGraphEditor.cs @@ -0,0 +1,41 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links.Mixed; + +/// +/// Enables changing declared links on resource types and relationships, so the model does not need to be duplicated for testing. +/// +internal sealed class ResourceGraphEditor +{ + private readonly Dictionary _resourceTypesByClrTypeName; + + public ResourceGraphEditor(ResourceGraphBuilder builder) + { + IResourceGraph resourceGraph = builder.Build(); + _resourceTypesByClrTypeName = resourceGraph.GetResourceTypes().ToDictionary(resourceType => resourceType.ClrType, resourceType => resourceType); + } + + public void ChangeLinksInResourceType(Type resourceClrType, LinkTypes? topLevelLinks, LinkTypes? resourceLinks, LinkTypes? relationshipLinks) + { + ResourceType resourceType = _resourceTypesByClrTypeName[resourceClrType]; + + _resourceTypesByClrTypeName[resourceClrType] = new ResourceType(resourceType.PublicName, resourceType.ClientIdGeneration, resourceType.ClrType, + resourceType.IdentityClrType, resourceType.Attributes, resourceType.Relationships, resourceType.EagerLoads, + topLevelLinks ?? resourceType.TopLevelLinks, resourceLinks ?? resourceType.ResourceLinks, relationshipLinks ?? resourceType.RelationshipLinks); + } + + public void ChangeLinkInRelationship(Type resourceClrType, string relationshipPropertyName, LinkTypes links) + { + ResourceType resourceType = _resourceTypesByClrTypeName[resourceClrType]; + + RelationshipAttribute relationship = resourceType.GetRelationshipByPropertyName(relationshipPropertyName); + relationship.Links = links; + } + + public IResourceGraph GetResourceGraph() + { + HashSet resourceTypeSet = _resourceTypesByClrTypeName.Values.ToHashSet(); + return new ResourceGraph(resourceTypeSet); + } +} diff --git a/test/OpenApiTests/Links/Transport.cs b/test/OpenApiTests/Links/Transport.cs new file mode 100644 index 0000000000..dda6021f0b --- /dev/null +++ b/test/OpenApiTests/Links/Transport.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Transport : Identifiable +{ + [Attr] + [Required] + public TransportType? Type { get; set; } + + [Attr] + [Required] + public int? DurationInMinutes { get; set; } +} diff --git a/test/OpenApiTests/Links/TransportType.cs b/test/OpenApiTests/Links/TransportType.cs new file mode 100644 index 0000000000..6f1bbf9ea7 --- /dev/null +++ b/test/OpenApiTests/Links/TransportType.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum TransportType +{ + Airplane, + Train, + Bus, + Boat +} diff --git a/test/OpenApiTests/Links/Vacation.cs b/test/OpenApiTests/Links/Vacation.cs new file mode 100644 index 0000000000..df592a4423 --- /dev/null +++ b/test/OpenApiTests/Links/Vacation.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.Links; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.Links")] +public sealed class Vacation : Identifiable +{ + [Attr] + [Required] + public DateTime? StartsAt { get; set; } + + [Attr] + [Required] + public DateTime? EndsAt { get; set; } + + [HasOne] + public Accommodation Accommodation { get; set; } = null!; + + [HasOne] + public Transport? Transport { get; set; } + + [HasMany] + public ISet Excursions { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..05a83c87ee --- /dev/null +++ b/test/OpenApiTests/ModelStateValidation/GeneratedSwagger/swagger.g.json @@ -0,0 +1,1064 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/socialMediaAccounts": { + "post": { + "tags": [ + "socialMediaAccounts" + ], + "summary": "Creates a new socialMediaAccount.", + "operationId": "postSocialMediaAccount", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the socialMediaAccount to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createSocialMediaAccountRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The socialMediaAccount was successfully created, which resulted in additional changes. The newly created socialMediaAccount is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created socialMediaAccount can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primarySocialMediaAccountResponseDocument" + } + } + } + }, + "204": { + "description": "The socialMediaAccount was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/socialMediaAccounts/{id}": { + "patch": { + "tags": [ + "socialMediaAccounts" + ], + "summary": "Updates an existing socialMediaAccount.", + "operationId": "patchSocialMediaAccount", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the socialMediaAccount to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the socialMediaAccount to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateSocialMediaAccountRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The socialMediaAccount was successfully updated, which resulted in additional changes. The updated socialMediaAccount is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primarySocialMediaAccountResponseDocument" + } + } + } + }, + "204": { + "description": "The socialMediaAccount was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The socialMediaAccount or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateSocialMediaAccountRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "lastName" + ], + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInSocialMediaAccountResponse" + } + }, + "x-abstract": true + }, + "attributesInSocialMediaAccountResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "socialMediaAccounts": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateSocialMediaAccountRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "alternativeId": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "firstName": { + "maxLength": 20, + "minLength": 2, + "type": "string", + "nullable": true + }, + "lastName": { + "type": "string" + }, + "userName": { + "maxLength": 18, + "minLength": 3, + "pattern": "^[a-zA-Z]+$", + "type": "string", + "nullable": true + }, + "creditCard": { + "type": "string", + "format": "credit-card", + "nullable": true + }, + "email": { + "type": "string", + "format": "email", + "nullable": true + }, + "password": { + "maxLength": 60, + "minLength": 20, + "type": "string", + "format": "byte", + "nullable": true + }, + "phone": { + "type": "string", + "format": "tel", + "nullable": true + }, + "age": { + "maximum": 122.9, + "exclusiveMaximum": true, + "minimum": 0.1, + "exclusiveMinimum": true, + "type": "number", + "format": "double", + "nullable": true + }, + "profilePicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "backgroundPicture": { + "type": "string", + "format": "uri", + "nullable": true + }, + "tags": { + "maxItems": 10, + "minItems": 1, + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "countryCode": { + "type": "string", + "nullable": true + }, + "planet": { + "type": "string", + "nullable": true + }, + "nextRevalidation": { + "type": "string", + "format": "date-span", + "nullable": true + }, + "validatedAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "validatedAtDate": { + "type": "string", + "format": "date", + "nullable": true + }, + "validatedAtTime": { + "type": "string", + "format": "time", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createSocialMediaAccountRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateSocialMediaAccountRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateSocialMediaAccountRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateSocialMediaAccountRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInSocialMediaAccountResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInSocialMediaAccountResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateSocialMediaAccountRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateSocialMediaAccountRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "primarySocialMediaAccountResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInSocialMediaAccountResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInCreateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInSocialMediaAccountResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "socialMediaAccounts": "#/components/schemas/dataInUpdateSocialMediaAccountRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "socialMediaAccounts" + ], + "type": "string" + }, + "updateSocialMediaAccountRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateSocialMediaAccountRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ModelStateValidation/ModelStateValidationDbContext.cs b/test/OpenApiTests/ModelStateValidation/ModelStateValidationDbContext.cs new file mode 100644 index 0000000000..d8b681b3ea --- /dev/null +++ b/test/OpenApiTests/ModelStateValidation/ModelStateValidationDbContext.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.ModelStateValidation; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ModelStateValidationDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet SocialMediaAccounts => Set(); +} diff --git a/test/OpenApiTests/ModelStateValidation/ModelStateValidationFakers.cs b/test/OpenApiTests/ModelStateValidation/ModelStateValidationFakers.cs new file mode 100644 index 0000000000..1fdc2203da --- /dev/null +++ b/test/OpenApiTests/ModelStateValidation/ModelStateValidationFakers.cs @@ -0,0 +1,44 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.ModelStateValidation; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ModelStateValidationFakers +{ + private readonly Lazy> _lazySocialMediaAccountFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(socialMediaAccount => socialMediaAccount.AlternativeId, faker => faker.Random.Guid()) + .RuleFor(socialMediaAccount => socialMediaAccount.FirstName, faker => faker.Person.FirstName) + .RuleFor(socialMediaAccount => socialMediaAccount.LastName, faker => faker.Person.LastName) + .RuleFor(socialMediaAccount => socialMediaAccount.UserName, faker => faker.Random.String2(3, 18)) + .RuleFor(socialMediaAccount => socialMediaAccount.CreditCard, faker => faker.Finance.CreditCardNumber()) + .RuleFor(socialMediaAccount => socialMediaAccount.Email, faker => faker.Person.Email) + .RuleFor(socialMediaAccount => socialMediaAccount.Password, faker => + { + int byteCount = faker.Random.Number(ModelStateValidation.SocialMediaAccount.MinPasswordChars, + ModelStateValidation.SocialMediaAccount.MaxPasswordChars); + + return Convert.ToBase64String(faker.Random.Bytes(byteCount)); + }) + .RuleFor(socialMediaAccount => socialMediaAccount.Phone, faker => faker.Person.Phone) + .RuleFor(socialMediaAccount => socialMediaAccount.Age, faker => faker.Random.Double(0.1, 122.9)) + .RuleFor(socialMediaAccount => socialMediaAccount.ProfilePicture, faker => new Uri(faker.Image.LoremFlickrUrl())) + .RuleFor(socialMediaAccount => socialMediaAccount.BackgroundPicture, faker => faker.Image.LoremFlickrUrl()) + .RuleFor(socialMediaAccount => socialMediaAccount.Tags, faker => faker.Make(faker.Random.Number(1, 10), () => faker.Random.Word())) + .RuleFor(socialMediaAccount => socialMediaAccount.CountryCode, faker => faker.Random.ListItem([ + "NL", + "FR" + ])) + .RuleFor(socialMediaAccount => socialMediaAccount.Planet, faker => faker.Random.Word()) + .RuleFor(socialMediaAccount => socialMediaAccount.NextRevalidation, faker => TimeSpan.FromHours(faker.Random.Number(1, 5))) + .RuleFor(socialMediaAccount => socialMediaAccount.ValidatedAt, faker => faker.Date.Recent().ToUniversalTime().TruncateToWholeMilliseconds()) + .RuleFor(socialMediaAccount => socialMediaAccount.ValidatedAtDate, faker => DateOnly.FromDateTime(faker.Date.Recent())) + .RuleFor(socialMediaAccount => socialMediaAccount.ValidatedAtTime, faker => TimeOnly.FromDateTime(faker.Date.Recent().TruncateToWholeMilliseconds()))); + + public Faker SocialMediaAccount => _lazySocialMediaAccountFaker.Value; +} diff --git a/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs b/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs new file mode 100644 index 0000000000..3040cb6a26 --- /dev/null +++ b/test/OpenApiTests/ModelStateValidation/ModelStateValidationTests.cs @@ -0,0 +1,299 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ModelStateValidation; + +public sealed class ModelStateValidationTests : IClassFixture, ModelStateValidationDbContext>> +{ + // ReSharper disable once UseCollectionExpression (https://youtrack.jetbrains.com/issue/RSRP-497450) + public static readonly TheoryData SchemaNames = new() + { + "attributesInCreateSocialMediaAccountRequest", + "attributesInUpdateSocialMediaAccountRequest", + "attributesInSocialMediaAccountResponse" + }; + + private readonly OpenApiTestContext, ModelStateValidationDbContext> _testContext; + + public ModelStateValidationTests(OpenApiTestContext, ModelStateValidationDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Guid_type_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.alternativeId").With(alternativeIdElement => + { + alternativeIdElement.Should().HaveProperty("type", "string"); + alternativeIdElement.Should().HaveProperty("format", "uuid"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Length_annotation_on_resource_string_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.firstName").With(firstNameElement => + { + firstNameElement.Should().HaveProperty("type", "string"); + firstNameElement.Should().HaveProperty("maxLength", 20); + firstNameElement.Should().HaveProperty("minLength", 2); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Required_annotation_with_AllowEmptyStrings_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.lastName").With(lastNameElement => + { + lastNameElement.Should().HaveProperty("type", "string"); + lastNameElement.Should().NotContainPath("minLength"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task StringLength_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => + { + userNameElement.Should().HaveProperty("type", "string"); + userNameElement.Should().HaveProperty("maxLength", 18); + userNameElement.Should().HaveProperty("minLength", 3); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task RegularExpression_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.userName").With(userNameElement => + { + userNameElement.Should().HaveProperty("type", "string"); + userNameElement.Should().HaveProperty("pattern", "^[a-zA-Z]+$"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task CreditCard_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.creditCard").With(creditCardElement => + { + creditCardElement.Should().HaveProperty("type", "string"); + creditCardElement.Should().HaveProperty("format", "credit-card"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Email_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.email").With(emailElement => + { + emailElement.Should().HaveProperty("type", "string"); + emailElement.Should().HaveProperty("format", "email"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Min_max_length_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.password").With(passwordElement => + { + passwordElement.Should().HaveProperty("type", "string"); + passwordElement.Should().HaveProperty("format", "byte"); + passwordElement.Should().HaveProperty("maxLength", SocialMediaAccount.MaxPasswordCharsInBase64); + passwordElement.Should().HaveProperty("minLength", SocialMediaAccount.MinPasswordCharsInBase64); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Phone_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.phone").With(phoneElement => + { + phoneElement.Should().HaveProperty("type", "string"); + phoneElement.Should().HaveProperty("format", "tel"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Range_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.age").With(ageElement => + { + ageElement.Should().HaveProperty("type", "number"); + ageElement.Should().HaveProperty("format", "double"); + ageElement.Should().HaveProperty("maximum", 122.9); + ageElement.Should().HaveProperty("minimum", 0.1); + ageElement.Should().ContainPath("exclusiveMaximum").With(exclusiveElement => exclusiveElement.Should().Be(true)); + ageElement.Should().ContainPath("exclusiveMinimum").With(exclusiveElement => exclusiveElement.Should().Be(true)); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Url_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.profilePicture").With(profilePictureElement => + { + profilePictureElement.Should().HaveProperty("type", "string"); + profilePictureElement.Should().HaveProperty("format", "uri"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Uri_type_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.backgroundPicture").With(backgroundPictureElement => + { + backgroundPictureElement.Should().HaveProperty("type", "string"); + backgroundPictureElement.Should().HaveProperty("format", "uri"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task Length_annotation_on_resource_list_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.tags").With(tagsElement => + { + tagsElement.Should().HaveProperty("type", "array"); + tagsElement.Should().HaveProperty("maxItems", 10); + tagsElement.Should().HaveProperty("minItems", 1); + + tagsElement.Should().ContainPath("items").With(itemsElement => + { + itemsElement.Should().HaveProperty("type", "string"); + }); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task TimeSpan_range_annotation_on_resource_property_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.nextRevalidation").With(nextRevalidationElement => + { + nextRevalidationElement.Should().HaveProperty("type", "string"); + nextRevalidationElement.Should().HaveProperty("format", "date-span"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task DateTime_type_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAt").With(validatedAtElement => + { + validatedAtElement.Should().HaveProperty("type", "string"); + validatedAtElement.Should().HaveProperty("format", "date-time"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task DateOnly_type_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtDate").With(validatedDateAtElement => + { + validatedDateAtElement.Should().HaveProperty("type", "string"); + validatedDateAtElement.Should().HaveProperty("format", "date"); + }); + } + + [Theory] + [MemberData(nameof(SchemaNames))] + public async Task TimeOnly_type_produces_expected_schema(string modelName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"components.schemas.{modelName}.allOf[1].properties.validatedAtTime").With(validatedTimeAtElement => + { + validatedTimeAtElement.Should().HaveProperty("type", "string"); + validatedTimeAtElement.Should().HaveProperty("format", "time"); + }); + } +} diff --git a/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs b/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs new file mode 100644 index 0000000000..28fbd7148d --- /dev/null +++ b/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs @@ -0,0 +1,88 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ModelStateValidation; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ModelStateValidation", GenerateControllerEndpoints = JsonApiEndpoints.Post | JsonApiEndpoints.Patch)] +public sealed class SocialMediaAccount : Identifiable +{ + public const int MinPasswordChars = 15; + public const int MinPasswordCharsInBase64 = (int)(4.0 / 3 * MinPasswordChars); + + public const int MaxPasswordChars = 45; + public const int MaxPasswordCharsInBase64 = (int)(4.0 / 3 * MaxPasswordChars); + + [Attr] + public Guid? AlternativeId { get; set; } + + [Attr] + [Length(2, 20)] + public string? FirstName { get; set; } + + [Attr] + [Required(AllowEmptyStrings = true)] + public string LastName { get; set; } = null!; + + [Attr] + [StringLength(18, MinimumLength = 3)] + [RegularExpression("^[a-zA-Z]+$", ErrorMessage = "Only letters are allowed.")] + public string? UserName { get; set; } + + [Attr] + [CreditCard] + public string? CreditCard { get; set; } + + [Attr] + [EmailAddress] + public string? Email { get; set; } + + [Attr] + [Base64String] + [MinLength(MinPasswordCharsInBase64)] + [MaxLength(MaxPasswordCharsInBase64)] + public string? Password { get; set; } + + [Attr] + [Phone] + public string? Phone { get; set; } + + [Attr] + [Range(0.1, 122.9, MinimumIsExclusive = true, MaximumIsExclusive = true)] + public double? Age { get; set; } + + [Attr] + public Uri? ProfilePicture { get; set; } + + [Attr] + [Url] + public string? BackgroundPicture { get; set; } + + [Attr] + [Length(1, 10)] + public List? Tags { get; set; } + + [Attr] + [AllowedValues(null, "NL", "FR")] + public string? CountryCode { get; set; } + + [Attr] + [DeniedValues("pluto")] + public string? Planet { get; set; } + + [Attr] + [Range(typeof(TimeSpan), "01:00", "05:00", ConvertValueInInvariantCulture = true)] + public TimeSpan? NextRevalidation { get; set; } + + [Attr] + public DateTime? ValidatedAt { get; set; } + + [Attr] + public DateOnly? ValidatedAtDate { get; set; } + + [Attr] + public TimeOnly? ValidatedAtTime { get; set; } +} diff --git a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseNamingConventionStartup.cs b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseNamingConventionStartup.cs new file mode 100644 index 0000000000..cf910b3a53 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseNamingConventionStartup.cs @@ -0,0 +1,22 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using TestBuildingBlocks; + +namespace OpenApiTests.NamingConventions.CamelCase; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class CamelCaseNamingConventionStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.IncludeJsonApiVersion = true; + options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + options.SerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; + options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); + } +} diff --git a/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs new file mode 100644 index 0000000000..ac102b673e --- /dev/null +++ b/test/OpenApiTests/NamingConventions/CamelCase/CamelCaseTests.cs @@ -0,0 +1,685 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.NamingConventions.CamelCase; + +public sealed class CamelCaseTests : IClassFixture, NamingConventionDbContext>> +{ + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; + + public CamelCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetCollection_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketCollection"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("supermarketCollectionResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("jsonapi"); + + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceCollectionTopLevelLinks").SchemaReferenceId; + + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("dataInSupermarketResponse") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + + string? resourceLinksSchemaRefId = null; + string? resourceAttributesInResponseSchemaRefId = null; + string? resourceRelationshipInResponseSchemaRefId = null; + + string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceInResponse").SchemaReferenceId; + + schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("dataInSupermarketResponse"); + mappingElement.Should().ContainPath("staffMembers").ShouldBeSchemaReferenceId("dataInStaffMemberResponse"); + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceLinks") + .SchemaReferenceId; + + resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") + .ShouldBeSchemaReferenceId("attributesInSupermarketResponse").SchemaReferenceId; + + resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("relationshipsInSupermarketResponse").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + }); + + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("nameOfCity"); + propertiesElement.Should().ContainProperty("kind"); + propertiesElement.Should().ContainPath("kind.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketType"); + }); + + string? nullableToOneResourceResponseDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("storeManager"); + + propertiesElement.Should().ContainPath("storeManager.allOf[0].$ref").ShouldBeSchemaReferenceId("toOneStaffMemberInResponse"); + + nullableToOneResourceResponseDataSchemaRefId = propertiesElement.Should().ContainPath("backupStoreManager.allOf[0].$ref") + .ShouldBeSchemaReferenceId("nullableToOneStaffMemberInResponse").SchemaReferenceId; + + propertiesElement.Should().ContainProperty("cashiers"); + propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("toManyStaffMemberInResponse"); + }); + + string? relationshipLinksSchemaRefId = null; + string? relatedResourceIdentifierSchemaRefId = null; + + schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => + { + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("relationshipLinks") + .SchemaReferenceId; + + relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("staffMemberIdentifierInResponse").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("related"); + }); + + string? relatedResourceTypeSchemaRefId = null; + + schemasElement.Should().ContainPath($"{relatedResourceIdentifierSchemaRefId}.properties").With(propertiesElement => + { + relatedResourceTypeSchemaRefId = propertiesElement.Should().ContainPath("type.allOf[0].$ref") + .ShouldBeSchemaReferenceId("staffMemberResourceType").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relatedResourceTypeSchemaRefId}.enum").With(codeElement => + { + codeElement.Should().ContainArrayElement("staffMembers"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSingle_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("primarySupermarketResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceTopLevelLinks") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/storeManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketStoreManager"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("secondaryStaffMemberResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInStaffMemberResponse") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInStaffMemberResponse"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/backupStoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketBackupStoreManager"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullableSecondaryStaffMemberResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketCashiers"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staffMemberCollectionResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/relationships/storeManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketStoreManagerRelationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staffMemberIdentifierResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceIdentifierTopLevelLinks").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/backupStoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketBackupStoreManagerRelationship"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullableStaffMemberIdentifierResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("getSupermarketCashiersRelationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staffMemberIdentifierCollectionResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resourceIdentifierCollectionTopLevelLinks").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Post_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("postSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("createSupermarketRequestDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("dataInCreateSupermarketRequest").SchemaReferenceId; + }); + + string? resourceRelationshipInPostRequestSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInCreateSupermarketRequest"); + + resourceRelationshipInPostRequestSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("relationshipsInCreateSupermarketRequest").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("storeManager"); + propertiesElement.Should().ContainPath("storeManager.allOf[0].$ref").ShouldBeSchemaReferenceId("toOneStaffMemberInRequest"); + + propertiesElement.Should().ContainProperty("backupStoreManager"); + propertiesElement.Should().ContainPath("backupStoreManager.allOf[0].$ref").ShouldBeSchemaReferenceId("nullableToOneStaffMemberInRequest"); + + propertiesElement.Should().ContainProperty("cashiers"); + propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("toManyStaffMemberInRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("postSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Patch_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patchSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("updateSupermarketRequestDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("dataInUpdateSupermarketRequest").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributesInUpdateSupermarketRequest"); + propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("relationshipsInUpdateSupermarketRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/storeManager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patchSupermarketStoreManagerRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/backupStoreManager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patchSupermarketBackupStoreManagerRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patchSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Delete_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("deleteSupermarket"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("deleteSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostOperations_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./operations.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("postOperations"); + }); + + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("operationsRequestDocument"); + + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("operationsResponseDocument"); + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath("addOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("add")); + schemasElement.Should().ContainPath("updateOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("update")); + schemasElement.Should().ContainPath("removeOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("remove")); + + schemasElement.Should().ContainPath("atomicOperation.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("addStaffMember").ShouldBeSchemaReferenceId("createStaffMemberOperation"); + mappingElement.Should().ContainPath("addSupermarket").ShouldBeSchemaReferenceId("createSupermarketOperation"); + mappingElement.Should().ContainPath("addToSupermarketCashiers").ShouldBeSchemaReferenceId("addToSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("removeFromSupermarketCashiers") + .ShouldBeSchemaReferenceId("removeFromSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("removeStaffMember").ShouldBeSchemaReferenceId("deleteStaffMemberOperation"); + mappingElement.Should().ContainPath("removeSupermarket").ShouldBeSchemaReferenceId("deleteSupermarketOperation"); + mappingElement.Should().ContainPath("updateStaffMember").ShouldBeSchemaReferenceId("updateStaffMemberOperation"); + mappingElement.Should().ContainPath("updateSupermarket").ShouldBeSchemaReferenceId("updateSupermarketOperation"); + + mappingElement.Should().ContainPath("updateSupermarketBackupStoreManager") + .ShouldBeSchemaReferenceId("updateSupermarketBackupStoreManagerRelationshipOperation"); + + mappingElement.Should().ContainPath("updateSupermarketCashiers").ShouldBeSchemaReferenceId("updateSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("updateSupermarketStoreManager") + .ShouldBeSchemaReferenceId("updateSupermarketStoreManagerRelationshipOperation"); + }); + + schemasElement.Should().ContainPath("createSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInCreateSupermarketRequest"); + }); + + schemasElement.Should().ContainPath("updateSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketIdentifierInRequest"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInUpdateSupermarketRequest"); + }); + + schemasElement.Should().ContainPath("deleteSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("updateSupermarketStoreManagerRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketStoreManagerRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("updateSupermarketBackupStoreManagerRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketBackupStoreManagerRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("updateSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("addToSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("removeFromSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("createStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInCreateStaffMemberRequest"); + }); + + schemasElement.Should().ContainPath("updateStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("dataInUpdateStaffMemberRequest"); + }); + + schemasElement.Should().ContainPath("deleteStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("staffMemberIdentifierInRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_error_schema() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.errorResponseDocument"); + document.Should().ContainPath("components.schemas.errorTopLevelLinks"); + } +} diff --git a/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..7a22ed8d57 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/CamelCase/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5079 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers.", + "operationId": "getStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "staffMembers" + ], + "summary": "Creates a new staffMember.", + "operationId": "postStaffMember", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The staffMember was successfully created, which resulted in additional changes. The newly created staffMember is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created staffMember can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers/{id}": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier.", + "operationId": "getStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The staffMember does not exist." + } + } + }, + "patch": { + "tags": [ + "staffMembers" + ], + "summary": "Updates an existing staffMember.", + "operationId": "patchStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The staffMember was successfully updated, which resulted in additional changes. The updated staffMember is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "staffMembers" + ], + "summary": "Deletes an existing staffMember by its identifier.", + "operationId": "deleteStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The staffMember was successfully deleted." + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/supermarkets": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves a collection of supermarkets.", + "operationId": "getSupermarketCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found supermarkets, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/supermarketCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves a collection of supermarkets without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "supermarkets" + ], + "summary": "Creates a new supermarket.", + "operationId": "postSupermarket", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the supermarket to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createSupermarketRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The supermarket was successfully created, which resulted in additional changes. The newly created supermarket is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created supermarket can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primarySupermarketResponseDocument" + } + } + } + }, + "204": { + "description": "The supermarket was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/supermarkets/{id}": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves an individual supermarket by its identifier.", + "operationId": "getSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found supermarket.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primarySupermarketResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves an individual supermarket by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Updates an existing supermarket.", + "operationId": "patchSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the supermarket to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateSupermarketRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The supermarket was successfully updated, which resulted in additional changes. The updated supermarket is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primarySupermarketResponseDocument" + } + } + } + }, + "204": { + "description": "The supermarket was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "supermarkets" + ], + "summary": "Deletes an existing supermarket by its identifier.", + "operationId": "deleteSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The supermarket was successfully deleted." + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/supermarkets/{id}/backupStoreManager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember of an individual supermarket's backupStoreManager relationship.", + "operationId": "getSupermarketBackupStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember of an individual supermarket's backupStoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketBackupStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/backupStoreManager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identity of an individual supermarket's backupStoreManager relationship.", + "operationId": "getSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableStaffMemberIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identity of an individual supermarket's backupStoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Clears or assigns an existing staffMember to the backupStoreManager relationship of an individual supermarket.", + "operationId": "patchSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose backupStoreManager relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the staffMember to assign to the backupStoreManager relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The backupStoreManager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/supermarkets/{id}/cashiers": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMembers of an individual supermarket's cashiers relationship.", + "operationId": "getSupermarketCashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMembers of an individual supermarket's cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketCashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/cashiers": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identities of an individual supermarket's cashiers relationship.", + "operationId": "getSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identities of an individual supermarket's cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "post": { + "tags": [ + "supermarkets" + ], + "summary": "Adds existing staffMembers to the cashiers relationship of an individual supermarket.", + "operationId": "postSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to add staffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to add to the cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Assigns existing staffMembers to the cashiers relationship of an individual supermarket.", + "operationId": "patchSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose cashiers relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to assign to the cashiers relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The cashiers relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "supermarkets" + ], + "summary": "Removes existing staffMembers from the cashiers relationship of an individual supermarket.", + "operationId": "deleteSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to remove staffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to remove from the cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/supermarkets/{id}/storeManager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember of an individual supermarket's storeManager relationship.", + "operationId": "getSupermarketStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember of an individual supermarket's storeManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/storeManager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identity of an individual supermarket's storeManager relationship.", + "operationId": "getSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staffMember identity of an individual supermarket's storeManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Assigns an existing staffMember to the storeManager relationship of an individual supermarket.", + "operationId": "patchSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose storeManager relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the staffMember to assign to the storeManager relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The storeManager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addStaffMember": "#/components/schemas/createStaffMemberOperation", + "addSupermarket": "#/components/schemas/createSupermarketOperation", + "addToSupermarketCashiers": "#/components/schemas/addToSupermarketCashiersRelationshipOperation", + "removeFromSupermarketCashiers": "#/components/schemas/removeFromSupermarketCashiersRelationshipOperation", + "removeStaffMember": "#/components/schemas/deleteStaffMemberOperation", + "removeSupermarket": "#/components/schemas/deleteSupermarketOperation", + "updateStaffMember": "#/components/schemas/updateStaffMemberOperation", + "updateSupermarket": "#/components/schemas/updateSupermarketOperation", + "updateSupermarketBackupStoreManager": "#/components/schemas/updateSupermarketBackupStoreManagerRelationshipOperation", + "updateSupermarketCashiers": "#/components/schemas/updateSupermarketCashiersRelationshipOperation", + "updateSupermarketStoreManager": "#/components/schemas/updateSupermarketStoreManagerRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInCreateStaffMemberRequest", + "supermarkets": "#/components/schemas/attributesInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "nameOfCity" + ], + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "supermarkets": "#/components/schemas/attributesInSupermarketResponse" + } + }, + "x-abstract": true + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staffMembers": "#/components/schemas/attributesInUpdateStaffMemberRequest", + "supermarkets": "#/components/schemas/attributesInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nameOfCity": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createSupermarketRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateSupermarketRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateSupermarketRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInSupermarketResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInSupermarketResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateSupermarketRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "deleteSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "supermarkets": "#/components/schemas/supermarketIdentifierInRequest" + } + }, + "x-abstract": true + }, + "jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableSecondaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableStaffMemberIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primarySupermarketResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInSupermarketResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "storeManager" + ], + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInRequest" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInSupermarketResponse" + } + }, + "x-abstract": true + }, + "relationshipsInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInResponse" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInResponse" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationshipsInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "storeManager": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneStaffMemberInRequest" + } + ] + }, + "backupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneStaffMemberInRequest" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInCreateStaffMemberRequest", + "supermarkets": "#/components/schemas/dataInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "supermarkets": "#/components/schemas/dataInSupermarketResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staffMembers": "#/components/schemas/dataInUpdateStaffMemberRequest", + "supermarkets": "#/components/schemas/dataInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "staffMembers", + "supermarkets" + ], + "type": "string" + }, + "secondaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "supermarketBackupStoreManagerRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketBackupStoreManagerRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "supermarketBackupStoreManagerRelationshipName": { + "enum": [ + "backupStoreManager" + ], + "type": "string" + }, + "supermarketCashiersRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketCashiersRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "supermarketCashiersRelationshipName": { + "enum": [ + "cashiers" + ], + "type": "string" + }, + "supermarketCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInSupermarketResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "supermarketIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "supermarketResourceType": { + "enum": [ + "supermarkets" + ], + "type": "string" + }, + "supermarketStoreManagerRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketStoreManagerRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "supermarketStoreManagerRelationshipName": { + "enum": [ + "storeManager" + ], + "type": "string" + }, + "supermarketType": { + "enum": [ + "Traditional", + "Budget", + "Warehouse" + ], + "type": "string" + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateSupermarketBackupStoreManagerRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketBackupStoreManagerRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateSupermarketRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateSupermarketRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateSupermarketStoreManagerRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarketStoreManagerRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..1955060d71 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/KebabCase/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5079 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "post-operations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operations-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operations-response-document" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/staff-members": { + "get": { + "tags": [ + "staff-members" + ], + "summary": "Retrieves a collection of staff-members.", + "operationId": "get-staff-member-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-members, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staff-member-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "staff-members" + ], + "summary": "Retrieves a collection of staff-members without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-staff-member-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "staff-members" + ], + "summary": "Creates a new staff-member.", + "operationId": "post-staff-member", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staff-member to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-staff-member-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The staff-member was successfully created, which resulted in additional changes. The newly created staff-member is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created staff-member can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-staff-member-response-document" + } + } + } + }, + "204": { + "description": "The staff-member was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/staff-members/{id}": { + "get": { + "tags": [ + "staff-members" + ], + "summary": "Retrieves an individual staff-member by its identifier.", + "operationId": "get-staff-member", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-staff-member-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The staff-member does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "staff-members" + ], + "summary": "Retrieves an individual staff-member by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-staff-member", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The staff-member does not exist." + } + } + }, + "patch": { + "tags": [ + "staff-members" + ], + "summary": "Updates an existing staff-member.", + "operationId": "patch-staff-member", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staff-member to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staff-member to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-staff-member-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The staff-member was successfully updated, which resulted in additional changes. The updated staff-member is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-staff-member-response-document" + } + } + } + }, + "204": { + "description": "The staff-member was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The staff-member or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "staff-members" + ], + "summary": "Deletes an existing staff-member by its identifier.", + "operationId": "delete-staff-member", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staff-member to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The staff-member was successfully deleted." + }, + "404": { + "description": "The staff-member does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/supermarkets": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves a collection of supermarkets.", + "operationId": "get-supermarket-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found supermarkets, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/supermarket-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves a collection of supermarkets without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-collection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "supermarkets" + ], + "summary": "Creates a new supermarket.", + "operationId": "post-supermarket", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the supermarket to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/create-supermarket-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The supermarket was successfully created, which resulted in additional changes. The newly created supermarket is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created supermarket can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-supermarket-response-document" + } + } + } + }, + "204": { + "description": "The supermarket was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/supermarkets/{id}": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves an individual supermarket by its identifier.", + "operationId": "get-supermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found supermarket.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-supermarket-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves an individual supermarket by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Updates an existing supermarket.", + "operationId": "patch-supermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the supermarket to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/update-supermarket-request-document" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The supermarket was successfully updated, which resulted in additional changes. The updated supermarket is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primary-supermarket-response-document" + } + } + } + }, + "204": { + "description": "The supermarket was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "supermarkets" + ], + "summary": "Deletes an existing supermarket by its identifier.", + "operationId": "delete-supermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The supermarket was successfully deleted." + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/supermarkets/{id}/backup-store-manager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member of an individual supermarket's backup-store-manager relationship.", + "operationId": "get-supermarket-backup-store-manager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-secondary-staff-member-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member of an individual supermarket's backup-store-manager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-backup-store-manager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/backup-store-manager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identity of an individual supermarket's backup-store-manager relationship.", + "operationId": "get-supermarket-backup-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullable-staff-member-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identity of an individual supermarket's backup-store-manager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-backup-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Clears or assigns an existing staff-member to the backup-store-manager relationship of an individual supermarket.", + "operationId": "patch-supermarket-backup-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose backup-store-manager relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the staff-member to assign to the backup-store-manager relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The backup-store-manager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/supermarkets/{id}/cashiers": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-members of an individual supermarket's cashiers relationship.", + "operationId": "get-supermarket-cashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-members to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-members, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staff-member-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-members of an individual supermarket's cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-cashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-members to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/cashiers": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identities of an individual supermarket's cashiers relationship.", + "operationId": "get-supermarket-cashiers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staff-member-identifier-collection-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identities of an individual supermarket's cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-cashiers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "post": { + "tags": [ + "supermarkets" + ], + "summary": "Adds existing staff-members to the cashiers relationship of an individual supermarket.", + "operationId": "post-supermarket-cashiers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to add staff-members to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staff-members to add to the cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff-members were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Assigns existing staff-members to the cashiers relationship of an individual supermarket.", + "operationId": "patch-supermarket-cashiers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose cashiers relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staff-members to assign to the cashiers relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The cashiers relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "delete": { + "tags": [ + "supermarkets" + ], + "summary": "Removes existing staff-members from the cashiers relationship of an individual supermarket.", + "operationId": "delete-supermarket-cashiers-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket to remove staff-members from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the staff-members to remove from the cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff-members were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + }, + "/supermarkets/{id}/store-manager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member of an individual supermarket's store-manager relationship.", + "operationId": "get-supermarket-store-manager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondary-staff-member-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member of an individual supermarket's store-manager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-store-manager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + } + }, + "/supermarkets/{id}/relationships/store-manager": { + "get": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identity of an individual supermarket's store-manager relationship.", + "operationId": "get-supermarket-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staff-member identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staff-member-identifier-response-document" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + }, + "head": { + "tags": [ + "supermarkets" + ], + "summary": "Retrieves the related staff-member identity of an individual supermarket's store-manager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "head-supermarket-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose related staff-member identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "supermarkets" + ], + "summary": "Assigns an existing staff-member to the store-manager relationship of an individual supermarket.", + "operationId": "patch-supermarket-store-manager-relationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the supermarket whose store-manager relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the staff-member to assign to the store-manager relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-request" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The store-manager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "404": { + "description": "The supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/error-response-document" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "add-operation-code": { + "enum": [ + "add" + ], + "type": "string" + }, + "add-to-supermarket-cashiers-relationship-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/add-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-cashiers-relationship-identifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomic-operation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "add-staff-member": "#/components/schemas/create-staff-member-operation", + "add-supermarket": "#/components/schemas/create-supermarket-operation", + "add-to-supermarket-cashiers": "#/components/schemas/add-to-supermarket-cashiers-relationship-operation", + "remove-from-supermarket-cashiers": "#/components/schemas/remove-from-supermarket-cashiers-relationship-operation", + "remove-staff-member": "#/components/schemas/delete-staff-member-operation", + "remove-supermarket": "#/components/schemas/delete-supermarket-operation", + "update-staff-member": "#/components/schemas/update-staff-member-operation", + "update-supermarket": "#/components/schemas/update-supermarket-operation", + "update-supermarket-backup-store-manager": "#/components/schemas/update-supermarket-backup-store-manager-relationship-operation", + "update-supermarket-cashiers": "#/components/schemas/update-supermarket-cashiers-relationship-operation", + "update-supermarket-store-manager": "#/components/schemas/update-supermarket-store-manager-relationship-operation" + } + }, + "x-abstract": true + }, + "atomic-result": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributes-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-create-staff-member-request", + "supermarkets": "#/components/schemas/attributes-in-create-supermarket-request" + } + }, + "x-abstract": true + }, + "attributes-in-create-staff-member-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-create-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-request" + }, + { + "required": [ + "name-of-city" + ], + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-staff-member-response", + "supermarkets": "#/components/schemas/attributes-in-supermarket-response" + } + }, + "x-abstract": true + }, + "attributes-in-staff-member-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-response" + }, + { + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "staff-members": "#/components/schemas/attributes-in-update-staff-member-request", + "supermarkets": "#/components/schemas/attributes-in-update-supermarket-request" + } + }, + "x-abstract": true + }, + "attributes-in-update-staff-member-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributes-in-update-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-request" + }, + { + "type": "object", + "properties": { + "name-of-city": { + "type": "string" + }, + "kind": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-type" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "create-staff-member-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/add-operation-code" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-staff-member-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "create-staff-member-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-staff-member-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "create-supermarket-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/add-operation-code" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-supermarket-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "create-supermarket-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-create-supermarket-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "data-in-create-staff-member-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-staff-member-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-create-supermarket-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-create-request" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-create-supermarket-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-supermarket-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-staff-member-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-staff-member-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-response" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-supermarket-response" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-supermarket-response" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-links" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-staff-member-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-staff-member-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "data-in-update-supermarket-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resource-in-update-request" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributes-in-update-supermarket-request" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-supermarket-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "delete-staff-member-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/remove-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "delete-supermarket-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/remove-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-identifier-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "error-links": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-object": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-links" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/error-source" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-response-document": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/error-top-level-links" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error-object" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "error-source": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "error-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifier-in-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/staff-member-identifier-in-request", + "supermarkets": "#/components/schemas/supermarket-identifier-in-request" + } + }, + "x-abstract": true + }, + "jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullable-secondary-staff-member-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-staff-member-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-staff-member-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullable-to-one-staff-member-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operations-request-document": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomic-operation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operations-response-document": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomic-result" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-staff-member-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primary-supermarket-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-supermarket-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationship-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationships-in-create-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-create-supermarket-request" + } + }, + "x-abstract": true + }, + "relationships-in-create-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-create-request" + }, + { + "required": [ + "store-manager" + ], + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-request" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-response": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-supermarket-response" + } + }, + "x-abstract": true + }, + "relationships-in-supermarket-response": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-response" + }, + { + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-response" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-response" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-response" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationships-in-update-request": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "supermarkets": "#/components/schemas/relationships-in-update-supermarket-request" + } + }, + "x-abstract": true + }, + "relationships-in-update-supermarket-request": { + "allOf": [ + { + "$ref": "#/components/schemas/relationships-in-update-request" + }, + { + "type": "object", + "properties": { + "store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/to-one-staff-member-in-request" + } + ] + }, + "backup-store-manager": { + "allOf": [ + { + "$ref": "#/components/schemas/nullable-to-one-staff-member-in-request" + } + ] + }, + "cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/to-many-staff-member-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "remove-from-supermarket-cashiers-relationship-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/remove-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-cashiers-relationship-identifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "remove-operation-code": { + "enum": [ + "remove" + ], + "type": "string" + }, + "resource-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-collection-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-identifier-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-in-create-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-create-staff-member-request", + "supermarkets": "#/components/schemas/data-in-create-supermarket-request" + } + }, + "x-abstract": true + }, + "resource-in-response": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-staff-member-response", + "supermarkets": "#/components/schemas/data-in-supermarket-response" + } + }, + "x-abstract": true + }, + "resource-in-update-request": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-type" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "staff-members": "#/components/schemas/data-in-update-staff-member-request", + "supermarkets": "#/components/schemas/data-in-update-supermarket-request" + } + }, + "x-abstract": true + }, + "resource-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-top-level-links": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resource-type": { + "enum": [ + "staff-members", + "supermarkets" + ], + "type": "string" + }, + "secondary-staff-member-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staff-member-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-staff-member-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staff-member-identifier-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staff-member-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staff-member-identifier-in-response": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-resource-type" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staff-member-identifier-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-identifier-top-level-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staff-member-resource-type": { + "enum": [ + "staff-members" + ], + "type": "string" + }, + "supermarket-backup-store-manager-relationship-identifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-resource-type" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-backup-store-manager-relationship-name" + } + ] + } + }, + "additionalProperties": false + }, + "supermarket-backup-store-manager-relationship-name": { + "enum": [ + "backup-store-manager" + ], + "type": "string" + }, + "supermarket-cashiers-relationship-identifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-resource-type" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-cashiers-relationship-name" + } + ] + } + }, + "additionalProperties": false + }, + "supermarket-cashiers-relationship-name": { + "enum": [ + "cashiers" + ], + "type": "string" + }, + "supermarket-collection-response-document": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resource-collection-top-level-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/data-in-supermarket-response" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resource-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "supermarket-identifier-in-request": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifier-in-request" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "supermarket-resource-type": { + "enum": [ + "supermarkets" + ], + "type": "string" + }, + "supermarket-store-manager-relationship-identifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-resource-type" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-store-manager-relationship-name" + } + ] + } + }, + "additionalProperties": false + }, + "supermarket-store-manager-relationship-name": { + "enum": [ + "store-manager" + ], + "type": "string" + }, + "supermarket-type": { + "enum": [ + "Traditional", + "Budget", + "Warehouse" + ], + "type": "string" + }, + "to-many-staff-member-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-many-staff-member-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-staff-member-in-request": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "to-one-staff-member-in-response": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationship-links" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-response" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-operation-code": { + "enum": [ + "update" + ], + "type": "string" + }, + "update-staff-member-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/update-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-staff-member-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "update-staff-member-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-staff-member-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-supermarket-backup-store-manager-relationship-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/update-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-backup-store-manager-relationship-identifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "update-supermarket-cashiers-relationship-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/update-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-cashiers-relationship-identifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "update-supermarket-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/update-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-identifier-in-request" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-supermarket-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "update-supermarket-request-document": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/data-in-update-supermarket-request" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "update-supermarket-store-manager-relationship-operation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomic-operation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/update-operation-code" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/supermarket-store-manager-relationship-identifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/staff-member-identifier-in-request" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/NamingConventions/KebabCase/JsonKebabCaseNamingPolicy.cs b/test/OpenApiTests/NamingConventions/KebabCase/JsonKebabCaseNamingPolicy.cs new file mode 100644 index 0000000000..aff836a470 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/KebabCase/JsonKebabCaseNamingPolicy.cs @@ -0,0 +1,81 @@ +using System.Text; +using System.Text.Json; + +namespace OpenApiTests.NamingConventions.KebabCase; + +// Based on https://github.com/J0rgeSerran0/JsonNamingPolicy +internal sealed class JsonKebabCaseNamingPolicy : JsonNamingPolicy +{ + private const char Separator = '-'; + + public static readonly JsonKebabCaseNamingPolicy Instance = new(); + + public override string ConvertName(string name) + { + if (string.IsNullOrWhiteSpace(name)) + { + return string.Empty; + } + + ReadOnlySpan spanName = name.Trim(); + + var stringBuilder = new StringBuilder(); + bool addCharacter = true; + + bool isNextLower = false; + bool isNextUpper = false; + bool isNextSpace = false; + + for (int position = 0; position < spanName.Length; position++) + { + if (position != 0) + { + bool isCurrentSpace = spanName[position] == 32; + bool isPreviousSpace = spanName[position - 1] == 32; + bool isPreviousSeparator = spanName[position - 1] == 95; + + if (position + 1 != spanName.Length) + { + isNextLower = spanName[position + 1] is >= 'a' and <= 'z'; + isNextUpper = spanName[position + 1] is >= 'A' and <= 'Z'; + isNextSpace = spanName[position + 1] == ' '; + } + + if (isCurrentSpace && (isPreviousSpace || isPreviousSeparator || isNextUpper || isNextSpace)) + { + addCharacter = false; + } + else + { + bool isCurrentUpper = spanName[position] is >= 'A' and <= 'Z'; + bool isPreviousLower = spanName[position - 1] is >= 'a' and <= 'z'; + bool isPreviousNumber = spanName[position - 1] is >= '0' and <= '9'; + + if (isCurrentUpper && (isPreviousLower || isPreviousNumber || isNextLower || isNextSpace)) + { + stringBuilder.Append(Separator); + } + else + { + if (isCurrentSpace) + { + stringBuilder.Append(Separator); + addCharacter = false; + } + } + } + } + + if (addCharacter) + { + stringBuilder.Append(spanName[position]); + } + else + { + addCharacter = true; + } + } + + return stringBuilder.ToString().ToLowerInvariant(); + } +} diff --git a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseNamingConventionStartup.cs b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseNamingConventionStartup.cs new file mode 100644 index 0000000000..cacd639813 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseNamingConventionStartup.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using TestBuildingBlocks; + +namespace OpenApiTests.NamingConventions.KebabCase; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class KebabCaseNamingConventionStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.IncludeJsonApiVersion = true; + options.SerializerOptions.PropertyNamingPolicy = JsonKebabCaseNamingPolicy.Instance; + options.SerializerOptions.DictionaryKeyPolicy = JsonKebabCaseNamingPolicy.Instance; + options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); + } +} diff --git a/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs new file mode 100644 index 0000000000..077d7ec5ed --- /dev/null +++ b/test/OpenApiTests/NamingConventions/KebabCase/KebabCaseTests.cs @@ -0,0 +1,692 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.NamingConventions.KebabCase; + +public sealed class KebabCaseTests : IClassFixture, NamingConventionDbContext>> +{ + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; + + public KebabCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetCollection_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-collection"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("supermarket-collection-response-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("jsonapi"); + + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-collection-top-level-links").SchemaReferenceId; + + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("data-in-supermarket-response") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + + string? resourceLinksSchemaRefId = null; + string? resourceAttributesInResponseSchemaRefId = null; + string? resourceRelationshipInResponseSchemaRefId = null; + + string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-in-response").SchemaReferenceId; + + schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("supermarkets").ShouldBeSchemaReferenceId("data-in-supermarket-response"); + mappingElement.Should().ContainPath("staff-members").ShouldBeSchemaReferenceId("data-in-staff-member-response"); + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resource-links") + .SchemaReferenceId; + + resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") + .ShouldBeSchemaReferenceId("attributes-in-supermarket-response").SchemaReferenceId; + + resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("relationships-in-supermarket-response").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + }); + + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("name-of-city"); + propertiesElement.Should().ContainProperty("kind"); + propertiesElement.Should().ContainPath("kind.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-type"); + }); + + string? nullableToOneResourceResponseDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("store-manager"); + + propertiesElement.Should().ContainPath("store-manager.allOf[0].$ref").ShouldBeSchemaReferenceId("to-one-staff-member-in-response"); + + nullableToOneResourceResponseDataSchemaRefId = propertiesElement.Should().ContainPath("backup-store-manager.allOf[0].$ref") + .ShouldBeSchemaReferenceId("nullable-to-one-staff-member-in-response").SchemaReferenceId; + + propertiesElement.Should().ContainProperty("cashiers"); + propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("to-many-staff-member-in-response"); + }); + + string? relationshipLinksSchemaRefId = null; + string? relatedResourceIdentifierSchemaRefId = null; + + schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => + { + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("relationship-links") + .SchemaReferenceId; + + relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("staff-member-identifier-in-response").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("related"); + }); + + string? relatedResourceTypeSchemaRefId = null; + + schemasElement.Should().ContainPath($"{relatedResourceIdentifierSchemaRefId}.properties").With(propertiesElement => + { + relatedResourceTypeSchemaRefId = propertiesElement.Should().ContainPath("type.allOf[0].$ref") + .ShouldBeSchemaReferenceId("staff-member-resource-type").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relatedResourceTypeSchemaRefId}.enum").With(codeElement => + { + codeElement.Should().ContainArrayElement("staff-members"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSingle_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("primary-supermarket-response-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("resource-top-level-links") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/store-manager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-store-manager"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("secondary-staff-member-response-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("data-in-staff-member-response").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-staff-member-response"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/backup-store-manager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-backup-store-manager"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullable-secondary-staff-member-response-document"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-cashiers"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staff-member-collection-response-document"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/relationships/store-manager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-store-manager-relationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staff-member-identifier-response-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-identifier-top-level-links").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/backup-store-manager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-backup-store-manager-relationship"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("nullable-staff-member-identifier-response-document"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("get-supermarket-cashiers-relationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("staff-member-identifier-collection-response-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("resource-identifier-collection-top-level-links").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Post_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("post-supermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("create-supermarket-request-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("data-in-create-supermarket-request").SchemaReferenceId; + }); + + string? resourceRelationshipInPostRequestSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-create-supermarket-request"); + + resourceRelationshipInPostRequestSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("relationships-in-create-supermarket-request").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("store-manager"); + propertiesElement.Should().ContainPath("store-manager.allOf[0].$ref").ShouldBeSchemaReferenceId("to-one-staff-member-in-request"); + + propertiesElement.Should().ContainProperty("backup-store-manager"); + + propertiesElement.Should().ContainPath("backup-store-manager.allOf[0].$ref") + .ShouldBeSchemaReferenceId("nullable-to-one-staff-member-in-request"); + + propertiesElement.Should().ContainProperty("cashiers"); + propertiesElement.Should().ContainPath("cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("to-many-staff-member-in-request"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("post-supermarket-cashiers-relationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Patch_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./supermarkets/{id}.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patch-supermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("update-supermarket-request-document").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("data-in-update-supermarket-request").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("attributes-in-update-supermarket-request"); + propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("relationships-in-update-supermarket-request"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/store-manager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patch-supermarket-store-manager-relationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/backup-store-manager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patch-supermarket-backup-store-manager-relationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("patch-supermarket-cashiers-relationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Delete_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("delete-supermarket"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./supermarkets/{id}/relationships/cashiers.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("delete-supermarket-cashiers-relationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostOperations_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./operations.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("post-operations"); + }); + + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("operations-request-document"); + + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("operations-response-document"); + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath("add-operation-code.enum").With(codeElement => codeElement.Should().ContainArrayElement("add")); + schemasElement.Should().ContainPath("update-operation-code.enum").With(codeElement => codeElement.Should().ContainArrayElement("update")); + schemasElement.Should().ContainPath("remove-operation-code.enum").With(codeElement => codeElement.Should().ContainArrayElement("remove")); + + schemasElement.Should().ContainPath("atomic-operation.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("add-staff-member").ShouldBeSchemaReferenceId("create-staff-member-operation"); + mappingElement.Should().ContainPath("add-supermarket").ShouldBeSchemaReferenceId("create-supermarket-operation"); + + mappingElement.Should().ContainPath("add-to-supermarket-cashiers") + .ShouldBeSchemaReferenceId("add-to-supermarket-cashiers-relationship-operation"); + + mappingElement.Should().ContainPath("remove-from-supermarket-cashiers") + .ShouldBeSchemaReferenceId("remove-from-supermarket-cashiers-relationship-operation"); + + mappingElement.Should().ContainPath("remove-staff-member").ShouldBeSchemaReferenceId("delete-staff-member-operation"); + mappingElement.Should().ContainPath("remove-supermarket").ShouldBeSchemaReferenceId("delete-supermarket-operation"); + mappingElement.Should().ContainPath("update-staff-member").ShouldBeSchemaReferenceId("update-staff-member-operation"); + mappingElement.Should().ContainPath("update-supermarket").ShouldBeSchemaReferenceId("update-supermarket-operation"); + + mappingElement.Should().ContainPath("update-supermarket-backup-store-manager") + .ShouldBeSchemaReferenceId("update-supermarket-backup-store-manager-relationship-operation"); + + mappingElement.Should().ContainPath("update-supermarket-cashiers") + .ShouldBeSchemaReferenceId("update-supermarket-cashiers-relationship-operation"); + + mappingElement.Should().ContainPath("update-supermarket-store-manager") + .ShouldBeSchemaReferenceId("update-supermarket-store-manager-relationship-operation"); + }); + + schemasElement.Should().ContainPath("create-supermarket-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("data-in-create-supermarket-request"); + }); + + schemasElement.Should().ContainPath("update-supermarket-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-identifier-in-request"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("data-in-update-supermarket-request"); + }); + + schemasElement.Should().ContainPath("delete-supermarket-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("update-supermarket-store-manager-relationship-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-store-manager-relationship-identifier"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("update-supermarket-backup-store-manager-relationship-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref") + .ShouldBeSchemaReferenceId("supermarket-backup-store-manager-relationship-identifier"); + + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("update-supermarket-cashiers-relationship-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-cashiers-relationship-identifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("add-to-supermarket-cashiers-relationship-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-cashiers-relationship-identifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("remove-from-supermarket-cashiers-relationship-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("supermarket-cashiers-relationship-identifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + + schemasElement.Should().ContainPath("create-staff-member-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("data-in-create-staff-member-request"); + }); + + schemasElement.Should().ContainPath("update-staff-member-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("data-in-update-staff-member-request"); + }); + + schemasElement.Should().ContainPath("delete-staff-member-operation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("staff-member-identifier-in-request"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_error_schema() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.error-response-document"); + document.Should().ContainPath("components.schemas.error-top-level-links"); + } +} diff --git a/test/OpenApiTests/NamingConventions/NamingConventionDbContext.cs b/test/OpenApiTests/NamingConventions/NamingConventionDbContext.cs new file mode 100644 index 0000000000..8fa74a219b --- /dev/null +++ b/test/OpenApiTests/NamingConventions/NamingConventionDbContext.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.NamingConventions; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class NamingConventionDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Supermarkets => Set(); +} diff --git a/test/OpenApiTests/NamingConventions/OperationsController.cs b/test/OpenApiTests/NamingConventions/OperationsController.cs new file mode 100644 index 0000000000..c4c024c099 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/OperationsController.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.NamingConventions; + +public sealed class OperationsController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IOperationsProcessor processor, IJsonApiRequest request, + ITargetedFields targetedFields, IAtomicOperationFilter operationFilter) + : JsonApiOperationsController(options, resourceGraph, loggerFactory, processor, request, targetedFields, operationFilter); diff --git a/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..ad97782721 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/PascalCase/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5079 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/Operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "PostOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/OperationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/OperationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/StaffMembers": { + "get": { + "tags": [ + "StaffMembers" + ], + "summary": "Retrieves a collection of StaffMembers.", + "operationId": "GetStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/StaffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "StaffMembers" + ], + "summary": "Retrieves a collection of StaffMembers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "StaffMembers" + ], + "summary": "Creates a new StaffMember.", + "operationId": "PostStaffMember", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the StaffMember to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/CreateStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The StaffMember was successfully created, which resulted in additional changes. The newly created StaffMember is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created StaffMember can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The StaffMember was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/StaffMembers/{id}": { + "get": { + "tags": [ + "StaffMembers" + ], + "summary": "Retrieves an individual StaffMember by its identifier.", + "operationId": "GetStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The StaffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "StaffMembers" + ], + "summary": "Retrieves an individual StaffMember by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The StaffMember does not exist." + } + } + }, + "patch": { + "tags": [ + "StaffMembers" + ], + "summary": "Updates an existing StaffMember.", + "operationId": "PatchStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the StaffMember to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the StaffMember to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The StaffMember was successfully updated, which resulted in additional changes. The updated StaffMember is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The StaffMember was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The StaffMember or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "StaffMembers" + ], + "summary": "Deletes an existing StaffMember by its identifier.", + "operationId": "DeleteStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the StaffMember to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The StaffMember was successfully deleted." + }, + "404": { + "description": "The StaffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/Supermarkets": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves a collection of Supermarkets.", + "operationId": "GetSupermarketCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found Supermarkets, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/SupermarketCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves a collection of Supermarkets without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "Supermarkets" + ], + "summary": "Creates a new Supermarket.", + "operationId": "PostSupermarket", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the Supermarket to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/CreateSupermarketRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The Supermarket was successfully created, which resulted in additional changes. The newly created Supermarket is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created Supermarket can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" + } + } + } + }, + "204": { + "description": "The Supermarket was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/Supermarkets/{id}": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves an individual Supermarket by its identifier.", + "operationId": "GetSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found Supermarket.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves an individual Supermarket by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "Supermarkets" + ], + "summary": "Updates an existing Supermarket.", + "operationId": "PatchSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the Supermarket to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateSupermarketRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The Supermarket was successfully updated, which resulted in additional changes. The updated Supermarket is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/PrimarySupermarketResponseDocument" + } + } + } + }, + "204": { + "description": "The Supermarket was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Supermarkets" + ], + "summary": "Deletes an existing Supermarket by its identifier.", + "operationId": "DeleteSupermarket", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The Supermarket was successfully deleted." + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/Supermarkets/{id}/BackupStoreManager": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember of an individual Supermarket's BackupStoreManager relationship.", + "operationId": "GetSupermarketBackupStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/NullableSecondaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember of an individual Supermarket's BackupStoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketBackupStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + } + }, + "/Supermarkets/{id}/relationships/BackupStoreManager": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identity of an individual Supermarket's BackupStoreManager relationship.", + "operationId": "GetSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/NullableStaffMemberIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identity of an individual Supermarket's BackupStoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "Supermarkets" + ], + "summary": "Clears or assigns an existing StaffMember to the BackupStoreManager relationship of an individual Supermarket.", + "operationId": "PatchSupermarketBackupStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose BackupStoreManager relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the StaffMember to assign to the BackupStoreManager relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The BackupStoreManager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/Supermarkets/{id}/Cashiers": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMembers of an individual Supermarket's Cashiers relationship.", + "operationId": "GetSupermarketCashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/StaffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMembers of an individual Supermarket's Cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketCashiers", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + } + }, + "/Supermarkets/{id}/relationships/Cashiers": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identities of an individual Supermarket's Cashiers relationship.", + "operationId": "GetSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/StaffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identities of an individual Supermarket's Cashiers relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + }, + "post": { + "tags": [ + "Supermarkets" + ], + "summary": "Adds existing StaffMembers to the Cashiers relationship of an individual Supermarket.", + "operationId": "PostSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to add StaffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the StaffMembers to add to the Cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The StaffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "Supermarkets" + ], + "summary": "Assigns existing StaffMembers to the Cashiers relationship of an individual Supermarket.", + "operationId": "PatchSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose Cashiers relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the StaffMembers to assign to the Cashiers relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The Cashiers relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Supermarkets" + ], + "summary": "Removes existing StaffMembers from the Cashiers relationship of an individual Supermarket.", + "operationId": "DeleteSupermarketCashiersRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket to remove StaffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the StaffMembers to remove from the Cashiers relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The StaffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + }, + "/Supermarkets/{id}/StoreManager": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember of an individual Supermarket's StoreManager relationship.", + "operationId": "GetSupermarketStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/SecondaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember of an individual Supermarket's StoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketStoreManager", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + } + }, + "/Supermarkets/{id}/relationships/StoreManager": { + "get": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identity of an individual Supermarket's StoreManager relationship.", + "operationId": "GetSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found StaffMember identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/StaffMemberIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "Supermarkets" + ], + "summary": "Retrieves the related StaffMember identity of an individual Supermarket's StoreManager relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "HeadSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose related StaffMember identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The Supermarket does not exist." + } + } + }, + "patch": { + "tags": [ + "Supermarkets" + ], + "summary": "Assigns an existing StaffMember to the StoreManager relationship of an individual Supermarket.", + "operationId": "PatchSupermarketStoreManagerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the Supermarket whose StoreManager relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the StaffMember to assign to the StoreManager relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The StoreManager relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "404": { + "description": "The Supermarket or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/ErrorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AddOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "AddToSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/AddOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AtomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "AddStaffMember": "#/components/schemas/CreateStaffMemberOperation", + "AddSupermarket": "#/components/schemas/CreateSupermarketOperation", + "AddToSupermarketCashiers": "#/components/schemas/AddToSupermarketCashiersRelationshipOperation", + "RemoveFromSupermarketCashiers": "#/components/schemas/RemoveFromSupermarketCashiersRelationshipOperation", + "RemoveStaffMember": "#/components/schemas/DeleteStaffMemberOperation", + "RemoveSupermarket": "#/components/schemas/DeleteSupermarketOperation", + "UpdateStaffMember": "#/components/schemas/UpdateStaffMemberOperation", + "UpdateSupermarket": "#/components/schemas/UpdateSupermarketOperation", + "UpdateSupermarketBackupStoreManager": "#/components/schemas/UpdateSupermarketBackupStoreManagerRelationshipOperation", + "UpdateSupermarketCashiers": "#/components/schemas/UpdateSupermarketCashiersRelationshipOperation", + "UpdateSupermarketStoreManager": "#/components/schemas/UpdateSupermarketStoreManagerRelationshipOperation" + } + }, + "x-abstract": true + }, + "AtomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "AttributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInCreateStaffMemberRequest", + "Supermarkets": "#/components/schemas/AttributesInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "AttributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateRequest" + }, + { + "required": [ + "Name" + ], + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateRequest" + }, + { + "required": [ + "NameOfCity" + ], + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInStaffMemberResponse", + "Supermarkets": "#/components/schemas/AttributesInSupermarketResponse" + } + }, + "x-abstract": true + }, + "AttributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInResponse" + }, + { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInResponse" + }, + { + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "StaffMembers": "#/components/schemas/AttributesInUpdateStaffMemberRequest", + "Supermarkets": "#/components/schemas/AttributesInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "AttributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "Name": { + "type": "string" + }, + "Age": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "AttributesInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "NameOfCity": { + "type": "string" + }, + "Kind": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketType" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "CreateStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/AddOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "CreateStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInCreateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "CreateSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/AddOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInCreateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "CreateSupermarketRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInCreateSupermarketRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "DataInCreateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInCreateSupermarketRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInCreateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInCreateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInSupermarketResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInSupermarketResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInUpdateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DataInUpdateSupermarketRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/AttributesInUpdateSupermarketRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DeleteStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/RemoveOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "DeleteSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/RemoveOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "ErrorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ErrorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "ErrorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "ErrorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ErrorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "IdentifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/StaffMemberIdentifierInRequest", + "Supermarkets": "#/components/schemas/SupermarketIdentifierInRequest" + } + }, + "x-abstract": true + }, + "Jsonapi": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "ext": { + "type": "array", + "items": { + "type": "string" + } + }, + "profile": { + "type": "array", + "items": { + "type": "string" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "Meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "NullableSecondaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "NullableStaffMemberIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "NullableToOneStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "NullableToOneStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "OperationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/AtomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "OperationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/AtomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "PrimaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "PrimarySupermarketResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInSupermarketResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "RelationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "RelationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "RelationshipsInCreateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInCreateRequest" + }, + { + "required": [ + "StoreManager" + ], + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInRequest" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "RelationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInSupermarketResponse" + } + }, + "x-abstract": true + }, + "RelationshipsInSupermarketResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInResponse" + }, + { + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInResponse" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInResponse" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "RelationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "Supermarkets": "#/components/schemas/RelationshipsInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "RelationshipsInUpdateSupermarketRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "StoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/ToOneStaffMemberInRequest" + } + ] + }, + "BackupStoreManager": { + "allOf": [ + { + "$ref": "#/components/schemas/NullableToOneStaffMemberInRequest" + } + ] + }, + "Cashiers": { + "allOf": [ + { + "$ref": "#/components/schemas/ToManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "RemoveFromSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/RemoveOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "RemoveOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "ResourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInCreateStaffMemberRequest", + "Supermarkets": "#/components/schemas/DataInCreateSupermarketRequest" + } + }, + "x-abstract": true + }, + "ResourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInStaffMemberResponse", + "Supermarkets": "#/components/schemas/DataInSupermarketResponse" + } + }, + "x-abstract": true + }, + "ResourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceType" + } + ] + }, + "Meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "StaffMembers": "#/components/schemas/DataInUpdateStaffMemberRequest", + "Supermarkets": "#/components/schemas/DataInUpdateSupermarketRequest" + } + }, + "x-abstract": true + }, + "ResourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ResourceType": { + "enum": [ + "StaffMembers", + "Supermarkets" + ], + "type": "string" + }, + "SecondaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "StaffMemberCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "StaffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "StaffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/IdentifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "StaffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "StaffMemberIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "StaffMemberResourceType": { + "enum": [ + "StaffMembers" + ], + "type": "string" + }, + "SupermarketBackupStoreManagerRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketBackupStoreManagerRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "SupermarketBackupStoreManagerRelationshipName": { + "enum": [ + "BackupStoreManager" + ], + "type": "string" + }, + "SupermarketCashiersRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketCashiersRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "SupermarketCashiersRelationshipName": { + "enum": [ + "Cashiers" + ], + "type": "string" + }, + "SupermarketCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "jsonapi": { + "allOf": [ + { + "$ref": "#/components/schemas/Jsonapi" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/ResourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DataInSupermarketResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "SupermarketIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/IdentifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "SupermarketResourceType": { + "enum": [ + "Supermarkets" + ], + "type": "string" + }, + "SupermarketStoreManagerRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketStoreManagerRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "SupermarketStoreManagerRelationshipName": { + "enum": [ + "StoreManager" + ], + "type": "string" + }, + "SupermarketType": { + "enum": [ + "Traditional", + "Budget", + "Warehouse" + ], + "type": "string" + }, + "ToManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "ToManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "ToOneStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "ToOneStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/RelationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "UpdateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "UpdateStaffMemberOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "UpdateStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInUpdateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "UpdateSupermarketBackupStoreManagerRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketBackupStoreManagerRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ], + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "UpdateSupermarketCashiersRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketCashiersRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "UpdateSupermarketOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInUpdateSupermarketRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "UpdateSupermarketRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/DataInUpdateSupermarketRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ] + } + }, + "additionalProperties": false + }, + "UpdateSupermarketStoreManagerRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/AtomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/UpdateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/SupermarketStoreManagerRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/StaffMemberIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseNamingConventionStartup.cs b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseNamingConventionStartup.cs new file mode 100644 index 0000000000..8a367641f2 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseNamingConventionStartup.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using TestBuildingBlocks; + +namespace OpenApiTests.NamingConventions.PascalCase; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class PascalCaseNamingConventionStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.IncludeJsonApiVersion = true; + options.SerializerOptions.PropertyNamingPolicy = null; + options.SerializerOptions.DictionaryKeyPolicy = null; + options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); + } +} diff --git a/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs new file mode 100644 index 0000000000..fb5405e6f6 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/PascalCase/PascalCaseTests.cs @@ -0,0 +1,685 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.NamingConventions.PascalCase; + +public sealed class PascalCaseTests : IClassFixture, NamingConventionDbContext>> +{ + private const string EscapedJsonApiMediaType = "['application/vnd.api+json; ext=openapi']"; + private const string EscapedOperationsMediaType = "['application/vnd.api+json; ext=atomic; ext=openapi']"; + + private readonly OpenApiTestContext, NamingConventionDbContext> _testContext; + + public PascalCaseTests(OpenApiTestContext, NamingConventionDbContext> testContext, + ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetCollection_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketCollection"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("SupermarketCollectionResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("jsonapi.allOf[0].$ref").ShouldBeSchemaReferenceId("Jsonapi"); + + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceCollectionTopLevelLinks").SchemaReferenceId; + + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("DataInSupermarketResponse") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + + string? resourceLinksSchemaRefId = null; + string? resourceAttributesInResponseSchemaRefId = null; + string? resourceRelationshipInResponseSchemaRefId = null; + + string abstractResourceDataSchemaRefId = schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceInResponse").SchemaReferenceId; + + schemasElement.Should().ContainPath($"{abstractResourceDataSchemaRefId}.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("Supermarkets").ShouldBeSchemaReferenceId("DataInSupermarketResponse"); + mappingElement.Should().ContainPath("StaffMembers").ShouldBeSchemaReferenceId("DataInStaffMemberResponse"); + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + resourceLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("ResourceLinks") + .SchemaReferenceId; + + resourceAttributesInResponseSchemaRefId = propertiesElement.Should().ContainPath("attributes.allOf[0].$ref") + .ShouldBeSchemaReferenceId("AttributesInSupermarketResponse").SchemaReferenceId; + + resourceRelationshipInResponseSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("RelationshipsInSupermarketResponse").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + }); + + schemasElement.Should().ContainPath($"{resourceAttributesInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("NameOfCity"); + propertiesElement.Should().ContainProperty("Kind"); + propertiesElement.Should().ContainPath("Kind.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketType"); + }); + + string? nullableToOneResourceResponseDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceRelationshipInResponseSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("StoreManager"); + + propertiesElement.Should().ContainPath("StoreManager.allOf[0].$ref").ShouldBeSchemaReferenceId("ToOneStaffMemberInResponse"); + + nullableToOneResourceResponseDataSchemaRefId = propertiesElement.Should().ContainPath("BackupStoreManager.allOf[0].$ref") + .ShouldBeSchemaReferenceId("NullableToOneStaffMemberInResponse").SchemaReferenceId; + + propertiesElement.Should().ContainProperty("Cashiers"); + propertiesElement.Should().ContainPath("Cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("ToManyStaffMemberInResponse"); + }); + + string? relationshipLinksSchemaRefId = null; + string? relatedResourceIdentifierSchemaRefId = null; + + schemasElement.Should().ContainPath($"{nullableToOneResourceResponseDataSchemaRefId}.properties").With(propertiesElement => + { + relationshipLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("RelationshipLinks") + .SchemaReferenceId; + + relatedResourceIdentifierSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("StaffMemberIdentifierInResponse").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relationshipLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("related"); + }); + + string? relatedResourceTypeSchemaRefId = null; + + schemasElement.Should().ContainPath($"{relatedResourceIdentifierSchemaRefId}.properties").With(propertiesElement => + { + relatedResourceTypeSchemaRefId = propertiesElement.Should().ContainPath("type.allOf[0].$ref") + .ShouldBeSchemaReferenceId("StaffMemberResourceType").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{relatedResourceTypeSchemaRefId}.enum").With(codeElement => + { + codeElement.Should().ContainArrayElement("StaffMembers"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSingle_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets/{id}.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("PrimarySupermarketResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref").ShouldBeSchemaReferenceId("ResourceTopLevelLinks") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_single_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets/{id}/StoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketStoreManager"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("SecondaryStaffMemberResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInStaffMemberResponse") + .SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInStaffMemberResponse"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_nullable_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/BackupStoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketBackupStoreManager"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("NullableSecondaryStaffMemberResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetSecondary_endpoint_with_resources() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/Cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketCashiers"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("StaffMemberCollectionResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/StoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketStoreManagerRelationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("StaffMemberIdentifierResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceIdentifierTopLevelLinks").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/BackupStoreManager.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketBackupStoreManagerRelationship"); + }); + + getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("NullableStaffMemberIdentifierResponseDocument"); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_GetRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.get").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("GetSupermarketCashiersRelationship"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"responses.200.content{EscapedJsonApiMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("StaffMemberIdentifierCollectionResponseDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? topLevelLinksSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + topLevelLinksSchemaRefId = propertiesElement.Should().ContainPath("links.allOf[0].$ref") + .ShouldBeSchemaReferenceId("ResourceIdentifierCollectionTopLevelLinks").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{topLevelLinksSchemaRefId}.properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("self"); + propertiesElement.Should().ContainProperty("describedby"); + propertiesElement.Should().ContainProperty("related"); + propertiesElement.Should().ContainProperty("first"); + propertiesElement.Should().ContainProperty("last"); + propertiesElement.Should().ContainProperty("prev"); + propertiesElement.Should().ContainProperty("next"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Post_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PostSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("CreateSupermarketRequestDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("DataInCreateSupermarketRequest").SchemaReferenceId; + }); + + string? resourceRelationshipInPostRequestSchemaRefId = null; + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInCreateSupermarketRequest"); + + resourceRelationshipInPostRequestSchemaRefId = propertiesElement.Should().ContainPath("relationships.allOf[0].$ref") + .ShouldBeSchemaReferenceId("RelationshipsInCreateSupermarketRequest").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceRelationshipInPostRequestSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainProperty("StoreManager"); + propertiesElement.Should().ContainPath("StoreManager.allOf[0].$ref").ShouldBeSchemaReferenceId("ToOneStaffMemberInRequest"); + + propertiesElement.Should().ContainProperty("BackupStoreManager"); + propertiesElement.Should().ContainPath("BackupStoreManager.allOf[0].$ref").ShouldBeSchemaReferenceId("NullableToOneStaffMemberInRequest"); + + propertiesElement.Should().ContainProperty("Cashiers"); + propertiesElement.Should().ContainPath("Cashiers.allOf[0].$ref").ShouldBeSchemaReferenceId("ToManyStaffMemberInRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PostSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Patch_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string? documentSchemaRefId = null; + + document.Should().ContainPath("paths./Supermarkets/{id}.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PatchSupermarket"); + }); + + documentSchemaRefId = getElement.Should().ContainPath($"requestBody.content{EscapedJsonApiMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("UpdateSupermarketRequestDocument").SchemaReferenceId; + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + string? resourceDataSchemaRefId = null; + + schemasElement.Should().ContainPath($"{documentSchemaRefId}.properties").With(propertiesElement => + { + resourceDataSchemaRefId = propertiesElement.Should().ContainPath("data.allOf[0].$ref") + .ShouldBeSchemaReferenceId("DataInUpdateSupermarketRequest").SchemaReferenceId; + }); + + schemasElement.Should().ContainPath($"{resourceDataSchemaRefId}.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("attributes.allOf[0].$ref").ShouldBeSchemaReferenceId("AttributesInUpdateSupermarketRequest"); + propertiesElement.Should().ContainPath("relationships.allOf[0].$ref").ShouldBeSchemaReferenceId("RelationshipsInUpdateSupermarketRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/StoreManager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PatchSupermarketStoreManagerRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_nullable_ToOne_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/BackupStoreManager.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PatchSupermarketBackupStoreManagerRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PatchRelationship_endpoint_with_ToMany_relationship() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.patch").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PatchSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_Delete_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("DeleteSupermarket"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_DeleteRelationship_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Supermarkets/{id}/relationships/Cashiers.delete").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("DeleteSupermarketCashiersRelationship"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_PostOperations_endpoint() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("paths./Operations.post").With(getElement => + { + getElement.Should().ContainPath("operationId").With(operationElement => + { + operationElement.Should().Be("PostOperations"); + }); + + getElement.Should().ContainPath($"requestBody.content{EscapedOperationsMediaType}.schema.allOf[0].$ref") + .ShouldBeSchemaReferenceId("OperationsRequestDocument"); + + getElement.Should().ContainPath($"responses.200.content{EscapedOperationsMediaType}.schema.$ref") + .ShouldBeSchemaReferenceId("OperationsResponseDocument"); + }); + + document.Should().ContainPath("components.schemas").With(schemasElement => + { + schemasElement.Should().ContainPath("AddOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("add")); + schemasElement.Should().ContainPath("UpdateOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("update")); + schemasElement.Should().ContainPath("RemoveOperationCode.enum").With(codeElement => codeElement.Should().ContainArrayElement("remove")); + + schemasElement.Should().ContainPath("AtomicOperation.discriminator.mapping").With(mappingElement => + { + mappingElement.Should().ContainPath("AddStaffMember").ShouldBeSchemaReferenceId("CreateStaffMemberOperation"); + mappingElement.Should().ContainPath("AddSupermarket").ShouldBeSchemaReferenceId("CreateSupermarketOperation"); + mappingElement.Should().ContainPath("AddToSupermarketCashiers").ShouldBeSchemaReferenceId("AddToSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("RemoveFromSupermarketCashiers") + .ShouldBeSchemaReferenceId("RemoveFromSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("RemoveStaffMember").ShouldBeSchemaReferenceId("DeleteStaffMemberOperation"); + mappingElement.Should().ContainPath("RemoveSupermarket").ShouldBeSchemaReferenceId("DeleteSupermarketOperation"); + mappingElement.Should().ContainPath("UpdateStaffMember").ShouldBeSchemaReferenceId("UpdateStaffMemberOperation"); + mappingElement.Should().ContainPath("UpdateSupermarket").ShouldBeSchemaReferenceId("UpdateSupermarketOperation"); + + mappingElement.Should().ContainPath("UpdateSupermarketBackupStoreManager") + .ShouldBeSchemaReferenceId("UpdateSupermarketBackupStoreManagerRelationshipOperation"); + + mappingElement.Should().ContainPath("UpdateSupermarketCashiers").ShouldBeSchemaReferenceId("UpdateSupermarketCashiersRelationshipOperation"); + + mappingElement.Should().ContainPath("UpdateSupermarketStoreManager") + .ShouldBeSchemaReferenceId("UpdateSupermarketStoreManagerRelationshipOperation"); + }); + + schemasElement.Should().ContainPath("CreateSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInCreateSupermarketRequest"); + }); + + schemasElement.Should().ContainPath("UpdateSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketIdentifierInRequest"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInUpdateSupermarketRequest"); + }); + + schemasElement.Should().ContainPath("DeleteSupermarketOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("UpdateSupermarketStoreManagerRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketStoreManagerRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("UpdateSupermarketBackupStoreManagerRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketBackupStoreManagerRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("UpdateSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("AddToSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("RemoveFromSupermarketCashiersRelationshipOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("SupermarketCashiersRelationshipIdentifier"); + propertiesElement.Should().ContainPath("data.items.$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + + schemasElement.Should().ContainPath("CreateStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInCreateStaffMemberRequest"); + }); + + schemasElement.Should().ContainPath("UpdateStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + propertiesElement.Should().ContainPath("data.allOf[0].$ref").ShouldBeSchemaReferenceId("DataInUpdateStaffMemberRequest"); + }); + + schemasElement.Should().ContainPath("DeleteStaffMemberOperation.allOf[1].properties").With(propertiesElement => + { + propertiesElement.Should().ContainPath("ref.allOf[0].$ref").ShouldBeSchemaReferenceId("StaffMemberIdentifierInRequest"); + }); + }); + } + + [Fact] + public async Task Casing_convention_is_applied_to_error_schema() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.ErrorResponseDocument"); + document.Should().ContainPath("components.schemas.ErrorTopLevelLinks"); + } +} diff --git a/test/OpenApiTests/NamingConventions/StaffMember.cs b/test/OpenApiTests/NamingConventions/StaffMember.cs new file mode 100644 index 0000000000..b2df548a17 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/StaffMember.cs @@ -0,0 +1,16 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.NamingConventions; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.NamingConventions")] +public sealed class StaffMember : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public int Age { get; set; } +} diff --git a/test/OpenApiTests/NamingConventions/Supermarket.cs b/test/OpenApiTests/NamingConventions/Supermarket.cs new file mode 100644 index 0000000000..4bde8776da --- /dev/null +++ b/test/OpenApiTests/NamingConventions/Supermarket.cs @@ -0,0 +1,25 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.NamingConventions; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.NamingConventions")] +public sealed class Supermarket : Identifiable +{ + [Attr] + public string NameOfCity { get; set; } = null!; + + [Attr] + public SupermarketType Kind { get; set; } + + [HasOne] + public StaffMember StoreManager { get; set; } = null!; + + [HasOne] + public StaffMember? BackupStoreManager { get; set; } + + [HasMany] + public ICollection Cashiers { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/NamingConventions/SupermarketType.cs b/test/OpenApiTests/NamingConventions/SupermarketType.cs new file mode 100644 index 0000000000..45570936f5 --- /dev/null +++ b/test/OpenApiTests/NamingConventions/SupermarketType.cs @@ -0,0 +1,11 @@ +using JetBrains.Annotations; + +namespace OpenApiTests.NamingConventions; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public enum SupermarketType +{ + Traditional, + Budget, + Warehouse +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyDbContext.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyDbContext.cs new file mode 100644 index 0000000000..b9805fc669 --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyDbContext.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class MissingFromBodyDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet RecycleBins => Set(); +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchController.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchController.cs new file mode 100644 index 0000000000..69f117c619 --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchController.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +public sealed class MissingFromBodyOnPatchController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IResourceService resourceService) + : BaseJsonApiController(options, resourceGraph, loggerFactory, resourceService) +{ + // Not overriding the base method, to trigger the error that [FromBody] is missing. + [HttpPatch("{id}")] + public Task AlternatePatchAsync([Required] long id, [Required] RecycleBin resource, CancellationToken cancellationToken) + { + return PatchAsync(id, resource, cancellationToken); + } +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs new file mode 100644 index 0000000000..20814f2f80 --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPatchMethodTests.cs @@ -0,0 +1,30 @@ +using FluentAssertions; +using JsonApiDotNetCore.Errors; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +public sealed class MissingFromBodyOnPatchMethodTests : OpenApiTestContext, MissingFromBodyDbContext> +{ + public MissingFromBodyOnPatchMethodTests(ITestOutputHelper testOutputHelper) + { + UseController(); + + SetTestOutputHelper(testOutputHelper); + } + + [Fact] + public async Task Cannot_use_Patch_controller_action_method_without_FromBody_attribute() + { + // Act + Func action = async () => _ = await GetSwaggerDocumentAsync(); + + // Assert + string? actionMethod = typeof(MissingFromBodyOnPatchController).GetMethod(nameof(MissingFromBodyOnPatchController.AlternatePatchAsync))!.ToString(); + string containingType = typeof(MissingFromBodyOnPatchController).ToString(); + + await action.Should().ThrowExactlyAsync().WithMessage( + $"The action method '{actionMethod}' on type '{containingType}' contains no parameter with a [FromBody] attribute."); + } +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostController.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostController.cs new file mode 100644 index 0000000000..479d95db40 --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostController.cs @@ -0,0 +1,19 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +public sealed class MissingFromBodyOnPostController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IResourceService resourceService) + : BaseJsonApiController(options, resourceGraph, loggerFactory, resourceService) +{ + // Not overriding the base method, to trigger the error that [FromBody] is missing. + [HttpPost] + public Task AlternatePostAsync(RecycleBin resource, CancellationToken cancellationToken) + { + return PostAsync(resource, cancellationToken); + } +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs new file mode 100644 index 0000000000..a121f058f9 --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/MissingFromBodyOnPostMethodTests.cs @@ -0,0 +1,30 @@ +using FluentAssertions; +using JsonApiDotNetCore.Errors; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +public sealed class MissingFromBodyOnPostMethodTests : OpenApiTestContext, MissingFromBodyDbContext> +{ + public MissingFromBodyOnPostMethodTests(ITestOutputHelper testOutputHelper) + { + UseController(); + + SetTestOutputHelper(testOutputHelper); + } + + [Fact] + public async Task Cannot_use_Post_controller_action_method_without_FromBody_attribute() + { + // Act + Func action = async () => _ = await GetSwaggerDocumentAsync(); + + // Assert + string? actionMethod = typeof(MissingFromBodyOnPostController).GetMethod(nameof(MissingFromBodyOnPostController.AlternatePostAsync))!.ToString(); + string containingType = typeof(MissingFromBodyOnPostController).ToString(); + + await action.Should().ThrowExactlyAsync().WithMessage( + $"The action method '{actionMethod}' on type '{containingType}' contains no parameter with a [FromBody] attribute."); + } +} diff --git a/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/RecycleBin.cs b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/RecycleBin.cs new file mode 100644 index 0000000000..51df92e0da --- /dev/null +++ b/test/OpenApiTests/OpenApiGenerationFailures/MissingFromBody/RecycleBin.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.OpenApiGenerationFailures.MissingFromBody; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.OpenApiGenerationFailures.MissingFromBody", GenerateControllerEndpoints = JsonApiEndpoints.None)] +public sealed class RecycleBin : Identifiable +{ + [Attr] + public bool IsEmpty { get; set; } +} diff --git a/test/OpenApiTests/OpenApiStartup.cs b/test/OpenApiTests/OpenApiStartup.cs new file mode 100644 index 0000000000..ba0a5256ca --- /dev/null +++ b/test/OpenApiTests/OpenApiStartup.cs @@ -0,0 +1,44 @@ +using System.Reflection; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.OpenApi.Swashbuckle; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Swashbuckle.AspNetCore.SwaggerGen; +using TestBuildingBlocks; + +namespace OpenApiTests; + +public class OpenApiStartup : TestableStartup + where TDbContext : TestableDbContext +{ + public override void ConfigureServices(IServiceCollection services) + { + base.ConfigureServices(services); + +#pragma warning disable JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + services.AddOpenApiForJsonApi(SetupSwaggerGenAction); +#pragma warning restore JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + } + + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.UseRelativeLinks = true; + options.IncludeTotalResourceCount = true; + } + + protected virtual void SetupSwaggerGenAction(SwaggerGenOptions options) + { + string documentationPath = Path.ChangeExtension(Assembly.GetExecutingAssembly().Location, ".xml"); + options.IncludeXmlComments(documentationPath); + } + + public override void Configure(IApplicationBuilder app) + { + app.UseRouting(); + app.UseJsonApi(); + app.UseSwagger(); + app.UseEndpoints(endpoints => endpoints.MapControllers()); + } +} diff --git a/test/OpenApiTests/OpenApiTestContext.cs b/test/OpenApiTests/OpenApiTestContext.cs new file mode 100644 index 0000000000..7743ab7533 --- /dev/null +++ b/test/OpenApiTests/OpenApiTestContext.cs @@ -0,0 +1,95 @@ +using System.Reflection; +using System.Text.Json; +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TestBuildingBlocks; +using Xunit.Abstractions; + +namespace OpenApiTests; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public class OpenApiTestContext : IntegrationTestContext + where TStartup : class + where TDbContext : TestableDbContext +{ + private readonly Lazy> _lazySwaggerDocument; + private ITestOutputHelper? _testOutputHelper; + + internal string? SwaggerDocumentOutputDirectory { get; set; } + + public OpenApiTestContext() + { + _lazySwaggerDocument = new Lazy>(CreateSwaggerDocumentAsync, LazyThreadSafetyMode.ExecutionAndPublication); + } + + internal async Task GetSwaggerDocumentAsync() + { + return await _lazySwaggerDocument.Value; + } + + private async Task CreateSwaggerDocumentAsync() + { + string content = await GetAsync("/swagger/v1/swagger.json"); + + JsonElement rootElement = ParseSwaggerDocument(content); + + if (SwaggerDocumentOutputDirectory != null) + { + string absoluteOutputPath = GetSwaggerDocumentAbsoluteOutputPath(SwaggerDocumentOutputDirectory); + await WriteToDiskAsync(absoluteOutputPath, rootElement); + } + + return rootElement; + } + + internal void SetTestOutputHelper(ITestOutputHelper testOutputHelper) + { + ArgumentNullException.ThrowIfNull(testOutputHelper); + + _testOutputHelper = testOutputHelper; + ConfigureLogging(AddXUnitProvider); + } + + private void AddXUnitProvider(ILoggingBuilder loggingBuilder) + { + if (_testOutputHelper != null) + { + loggingBuilder.SetMinimumLevel(LogLevel.Trace); + loggingBuilder.Services.AddSingleton(_ => new XUnitLoggerProvider(_testOutputHelper, "JsonApiDotNetCore.OpenApi.Swashbuckle")); + } + } + + private static string GetSwaggerDocumentAbsoluteOutputPath(string relativePath) + { + string testRootDirectory = Path.Combine(Assembly.GetExecutingAssembly().Location, "../../../../../"); + string outputPath = Path.Combine(testRootDirectory, relativePath, "swagger.g.json"); + + return Path.GetFullPath(outputPath); + } + + private async Task GetAsync(string requestUrl) + { + using var request = new HttpRequestMessage(HttpMethod.Get, requestUrl); + + using HttpClient client = Factory.CreateClient(); + using HttpResponseMessage responseMessage = await client.SendAsync(request); + + return await responseMessage.Content.ReadAsStringAsync(); + } + + private static JsonElement ParseSwaggerDocument(string content) + { + using JsonDocument jsonDocument = JsonDocument.Parse(content); + return jsonDocument.RootElement.Clone(); + } + + private static async Task WriteToDiskAsync(string path, JsonElement jsonElement) + { + string directory = Path.GetDirectoryName(path)!; + Directory.CreateDirectory(directory); + + string contents = jsonElement.ToString(); + await File.WriteAllTextAsync(path, contents); + } +} diff --git a/test/OpenApiTests/OpenApiTests.csproj b/test/OpenApiTests/OpenApiTests.csproj new file mode 100644 index 0000000000..ed2a75b5f4 --- /dev/null +++ b/test/OpenApiTests/OpenApiTests.csproj @@ -0,0 +1,29 @@ + + + net9.0;net8.0 + True + false + $(NoWarn);1591 + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..4b5473246c --- /dev/null +++ b/test/OpenApiTests/QueryStrings/GeneratedSwagger/swagger.g.json @@ -0,0 +1,4997 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/nameValuePairs": { + "get": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves a collection of nameValuePairs.", + "operationId": "getNameValuePairCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nameValuePairs, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nameValuePairCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves a collection of nameValuePairs without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNameValuePairCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "nameValuePairs" + ], + "summary": "Creates a new nameValuePair.", + "operationId": "postNameValuePair", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the nameValuePair to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createNameValuePairRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The nameValuePair was successfully created, which resulted in additional changes. The newly created nameValuePair is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created nameValuePair can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" + } + } + } + }, + "204": { + "description": "The nameValuePair was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nameValuePairs/{id}": { + "get": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves an individual nameValuePair by its identifier.", + "operationId": "getNameValuePair", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nameValuePair.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The nameValuePair does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves an individual nameValuePair by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNameValuePair", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The nameValuePair does not exist." + } + } + }, + "patch": { + "tags": [ + "nameValuePairs" + ], + "summary": "Updates an existing nameValuePair.", + "operationId": "patchNameValuePair", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the nameValuePair to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateNameValuePairRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The nameValuePair was successfully updated, which resulted in additional changes. The updated nameValuePair is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNameValuePairResponseDocument" + } + } + } + }, + "204": { + "description": "The nameValuePair was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The nameValuePair or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "nameValuePairs" + ], + "summary": "Deletes an existing nameValuePair by its identifier.", + "operationId": "deleteNameValuePair", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The nameValuePair was successfully deleted." + }, + "404": { + "description": "The nameValuePair does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nameValuePairs/{id}/owner": { + "get": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves the related node of an individual nameValuePair's owner relationship.", + "operationId": "getNameValuePairOwner", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair whose related node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryNodeResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The nameValuePair does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves the related node of an individual nameValuePair's owner relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNameValuePairOwner", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair whose related node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The nameValuePair does not exist." + } + } + } + }, + "/nameValuePairs/{id}/relationships/owner": { + "get": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves the related node identity of an individual nameValuePair's owner relationship.", + "operationId": "getNameValuePairOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair whose related node identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nodeIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The nameValuePair does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nameValuePairs" + ], + "summary": "Retrieves the related node identity of an individual nameValuePair's owner relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNameValuePairOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair whose related node identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The nameValuePair does not exist." + } + } + }, + "patch": { + "tags": [ + "nameValuePairs" + ], + "summary": "Assigns an existing node to the owner relationship of an individual nameValuePair.", + "operationId": "patchNameValuePairOwnerRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the nameValuePair whose owner relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the node to assign to the owner relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The owner relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The nameValuePair or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nodes": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves a collection of nodes.", + "operationId": "getNodeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nodes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nodeCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves a collection of nodes without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "nodes" + ], + "summary": "Creates a new node.", + "operationId": "postNode", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the node to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createNodeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The node was successfully created, which resulted in additional changes. The newly created node is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created node can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNodeResponseDocument" + } + } + } + }, + "204": { + "description": "The node was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nodes/{id}": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves an individual node by its identifier.", + "operationId": "getNode", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNodeResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves an individual node by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNode", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + }, + "patch": { + "tags": [ + "nodes" + ], + "summary": "Updates an existing node.", + "operationId": "patchNode", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the node to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateNodeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The node was successfully updated, which resulted in additional changes. The updated node is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryNodeResponseDocument" + } + } + } + }, + "204": { + "description": "The node was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "nodes" + ], + "summary": "Deletes an existing node by its identifier.", + "operationId": "deleteNode", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The node was successfully deleted." + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nodes/{id}/children": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nodes of an individual node's children relationship.", + "operationId": "getNodeChildren", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nodes to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nodes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nodeCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nodes of an individual node's children relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeChildren", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nodes to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + } + }, + "/nodes/{id}/relationships/children": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node identities of an individual node's children relationship.", + "operationId": "getNodeChildrenRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nodeIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node identities of an individual node's children relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeChildrenRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + }, + "post": { + "tags": [ + "nodes" + ], + "summary": "Adds existing nodes to the children relationship of an individual node.", + "operationId": "postNodeChildrenRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to add nodes to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nodes to add to the children relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nodes were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "nodes" + ], + "summary": "Assigns existing nodes to the children relationship of an individual node.", + "operationId": "patchNodeChildrenRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose children relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nodes to assign to the children relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The children relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "nodes" + ], + "summary": "Removes existing nodes from the children relationship of an individual node.", + "operationId": "deleteNodeChildrenRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to remove nodes from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nodes to remove from the children relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nodes were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nodes/{id}/parent": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node of an individual node's parent relationship.", + "operationId": "getNodeParent", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryNodeResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node of an individual node's parent relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeParent", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + } + }, + "/nodes/{id}/relationships/parent": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node identity of an individual node's parent relationship.", + "operationId": "getNodeParentRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found node identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableNodeIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related node identity of an individual node's parent relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeParentRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related node identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + }, + "patch": { + "tags": [ + "nodes" + ], + "summary": "Clears or assigns an existing node to the parent relationship of an individual node.", + "operationId": "patchNodeParentRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose parent relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the node to assign to the parent relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The parent relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/nodes/{id}/values": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nameValuePairs of an individual node's values relationship.", + "operationId": "getNodeValues", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nameValuePairs to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nameValuePairs, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nameValuePairCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nameValuePairs of an individual node's values relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeValues", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nameValuePairs to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + } + }, + "/nodes/{id}/relationships/values": { + "get": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nameValuePair identities of an individual node's values relationship.", + "operationId": "getNodeValuesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nameValuePair identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found nameValuePair identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nameValuePairIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "nodes" + ], + "summary": "Retrieves the related nameValuePair identities of an individual node's values relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headNodeValuesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose related nameValuePair identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The node does not exist." + } + } + }, + "post": { + "tags": [ + "nodes" + ], + "summary": "Adds existing nameValuePairs to the values relationship of an individual node.", + "operationId": "postNodeValuesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to add nameValuePairs to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nameValuePairs to add to the values relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nameValuePairs were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "nodes" + ], + "summary": "Assigns existing nameValuePairs to the values relationship of an individual node.", + "operationId": "patchNodeValuesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node whose values relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nameValuePairs to assign to the values relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The values relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "nodes" + ], + "summary": "Removes existing nameValuePairs from the values relationship of an individual node.", + "operationId": "deleteNodeValuesRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the node to remove nameValuePairs from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the nameValuePairs to remove from the values relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nameValuePairs were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The node or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInCreateNameValuePairRequest", + "nodes": "#/components/schemas/attributesInCreateNodeRequest" + } + }, + "x-abstract": true + }, + "attributesInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInNameValuePairResponse", + "nodes": "#/components/schemas/attributesInNodeResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/attributesInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/attributesInUpdateNodeRequest" + } + }, + "x-abstract": true + }, + "createNameValuePairRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateNameValuePairRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createNodeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateNodeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateNameValuePairRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateNameValuePairRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateNameValuePairRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateNodeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateNodeRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateNodeRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInNameValuePairResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInNameValuePairResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInNodeResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInNodeResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateNameValuePairRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateNameValuePairRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateNameValuePairRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateNodeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateNodeRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateNodeRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/nameValuePairIdentifierInRequest", + "nodes": "#/components/schemas/nodeIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nameValuePairCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInNameValuePairResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nameValuePairIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nameValuePairIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nameValuePairIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "nameValuePairIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/nameValuePairResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nameValuePairResourceType": { + "enum": [ + "nameValuePairs" + ], + "type": "string" + }, + "nodeCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInNodeResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nodeIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nodeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "nodeIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nodeIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nodeResourceType": { + "enum": [ + "nodes" + ], + "type": "string" + }, + "nullableNodeIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryNodeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInNodeResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneNodeInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneNodeInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryNameValuePairResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInNameValuePairResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryNodeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInNodeResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "owner" + ], + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInRequest" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInCreateNameValuePairRequest", + "nodes": "#/components/schemas/relationshipsInCreateNodeRequest" + } + }, + "x-abstract": true + }, + "relationshipsInNameValuePairResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInNodeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInResponse" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInResponse" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInNameValuePairResponse", + "nodes": "#/components/schemas/relationshipsInNodeResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateNameValuePairRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "owner": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateNodeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "values": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNameValuePairInRequest" + } + ] + }, + "parent": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneNodeInRequest" + } + ] + }, + "children": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyNodeInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "nameValuePairs": "#/components/schemas/relationshipsInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/relationshipsInUpdateNodeRequest" + } + }, + "x-abstract": true + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInCreateNameValuePairRequest", + "nodes": "#/components/schemas/dataInCreateNodeRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInNameValuePairResponse", + "nodes": "#/components/schemas/dataInNodeResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "nameValuePairs": "#/components/schemas/dataInUpdateNameValuePairRequest", + "nodes": "#/components/schemas/dataInUpdateNodeRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "nameValuePairs", + "nodes" + ], + "type": "string" + }, + "secondaryNodeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInNodeResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyNameValuePairInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nameValuePairIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyNameValuePairInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nameValuePairIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyNodeInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nodeIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyNodeInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneNodeInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneNodeInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/nodeIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateNameValuePairRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateNameValuePairRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateNodeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateNodeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/QueryStrings/IncludeTests.cs b/test/OpenApiTests/QueryStrings/IncludeTests.cs new file mode 100644 index 0000000000..78c82ad3d8 --- /dev/null +++ b/test/OpenApiTests/QueryStrings/IncludeTests.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using FluentAssertions; +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.QueryStrings; + +public sealed class IncludeTests : IClassFixture, QueryStringDbContext>> +{ + private readonly OpenApiTestContext, QueryStringDbContext> _testContext; + + public IncludeTests(OpenApiTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Fact] + public async Task Discriminator_is_generated_for_all_resource_types_when_subset_of_endpoints_is_exposed() + { + // Arrange + var resourceGraph = _testContext.Factory.Services.GetRequiredService(); + int count = resourceGraph.GetResourceTypes().Count; + + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas").With(schemasElement => + { + List discriminatorRefIds = []; + + schemasElement.Should().ContainPath("resourceInResponse.discriminator").With(discriminatorElement => + { + discriminatorElement.Should().HaveProperty("propertyName", "type"); + + discriminatorElement.Should().ContainPath("mapping").With(mappingElement => + { + foreach (JsonProperty jsonProperty in mappingElement.EnumerateObject()) + { + string discriminatorRefId = jsonProperty.Value.GetSchemaReferenceId(); + discriminatorRefIds.Add(discriminatorRefId); + } + }); + }); + + discriminatorRefIds.Should().HaveCount(count); + + foreach (string discriminatorRefId in discriminatorRefIds) + { + schemasElement.Should().ContainPath($"{discriminatorRefId}.allOf[0].$ref").ShouldBeSchemaReferenceId("resourceInResponse"); + } + }); + } + + [UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] + private sealed class OnlyGetSingleNodeController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IResourceService resourceService) + : BaseJsonApiController(options, resourceGraph, loggerFactory, resourceService) + { + [HttpGet("{id}")] + public override Task GetAsync(long id, CancellationToken cancellationToken) + { + return base.GetAsync(id, cancellationToken); + } + } +} diff --git a/test/OpenApiTests/QueryStrings/NameValuePair.cs b/test/OpenApiTests/QueryStrings/NameValuePair.cs new file mode 100644 index 0000000000..ab7fd2f61e --- /dev/null +++ b/test/OpenApiTests/QueryStrings/NameValuePair.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.QueryStrings; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.QueryStrings")] +public sealed class NameValuePair : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public string? Value { get; set; } + + [HasOne] + public Node Owner { get; set; } = null!; +} diff --git a/test/OpenApiTests/QueryStrings/Node.cs b/test/OpenApiTests/QueryStrings/Node.cs new file mode 100644 index 0000000000..e9da915295 --- /dev/null +++ b/test/OpenApiTests/QueryStrings/Node.cs @@ -0,0 +1,25 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.QueryStrings; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.QueryStrings")] +public sealed class Node : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [Attr] + public string? Comment { get; set; } + + [HasMany] + public IList Values { get; set; } = new List(); + + [HasOne] + public Node? Parent { get; set; } + + [HasMany] + public ISet Children { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/QueryStrings/QueryStringDbContext.cs b/test/OpenApiTests/QueryStrings/QueryStringDbContext.cs new file mode 100644 index 0000000000..337540262d --- /dev/null +++ b/test/OpenApiTests/QueryStrings/QueryStringDbContext.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.QueryStrings; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class QueryStringDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Nodes => Set(); +} diff --git a/test/OpenApiTests/QueryStrings/QueryStringFakers.cs b/test/OpenApiTests/QueryStrings/QueryStringFakers.cs new file mode 100644 index 0000000000..63b415219a --- /dev/null +++ b/test/OpenApiTests/QueryStrings/QueryStringFakers.cs @@ -0,0 +1,25 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.QueryStrings; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class QueryStringFakers +{ + private readonly Lazy> _lazyNodeFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(node => node.Name, faker => faker.Lorem.Word()) + .RuleFor(node => node.Comment, faker => faker.Lorem.Sentence())); + + private readonly Lazy> _lazyNameValuePairFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(node => node.Name, faker => faker.Lorem.Word()) + .RuleFor(node => node.Value, faker => faker.Lorem.Sentence())); + + public Faker Node => _lazyNodeFaker.Value; + public Faker NameValuePair => _lazyNameValuePairFaker.Value; +} diff --git a/test/OpenApiTests/QueryStrings/QueryStringTests.cs b/test/OpenApiTests/QueryStrings/QueryStringTests.cs new file mode 100644 index 0000000000..f74f773796 --- /dev/null +++ b/test/OpenApiTests/QueryStrings/QueryStringTests.cs @@ -0,0 +1,91 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.QueryStrings; + +public sealed class QueryStringTests : IClassFixture, QueryStringDbContext>> +{ + private readonly OpenApiTestContext, QueryStringDbContext> _testContext; + + public QueryStringTests(OpenApiTestContext, QueryStringDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("/nodes.get")] + [InlineData("/nodes.head")] + [InlineData("/nodes.post")] + [InlineData("/nodes/{id}.get")] + [InlineData("/nodes/{id}.head")] + [InlineData("/nodes/{id}.patch")] + [InlineData("/nodes/{id}/parent.get")] + [InlineData("/nodes/{id}/parent.head")] + [InlineData("/nodes/{id}/relationships/parent.get")] + [InlineData("/nodes/{id}/relationships/parent.head")] + [InlineData("/nodes/{id}/children.get")] + [InlineData("/nodes/{id}/children.head")] + [InlineData("/nodes/{id}/relationships/children.get")] + [InlineData("/nodes/{id}/relationships/children.head")] + public async Task Endpoints_have_query_string_parameter(string endpointPath) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"paths.{endpointPath}").With(verbElement => + { + verbElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().ContainSingle(element => element.GetProperty("in").ValueEquals("query")).Subject.With( + parameterElement => + { + parameterElement.Should().HaveProperty("name", "query"); + + parameterElement.Should().ContainPath("schema").With(schemaElement => + { + schemaElement.Should().HaveProperty("type", "object"); + + schemaElement.Should().ContainPath("additionalProperties").With(propertiesElement => + { + propertiesElement.Should().HaveProperty("type", "string"); + propertiesElement.Should().HaveProperty("nullable", true); + }); + + schemaElement.Should().HaveProperty("example", string.Empty); + }); + }); + }); + }); + } + + [Theory] + [InlineData("/nodes/{id}.delete")] + [InlineData("/nodes/{id}/relationships/parent.patch")] + [InlineData("/nodes/{id}/relationships/children.post")] + [InlineData("/nodes/{id}/relationships/children.patch")] + [InlineData("/nodes/{id}/relationships/children.delete")] + public async Task Endpoints_do_not_have_query_string_parameter(string endpointPath) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath($"paths.{endpointPath}").With(verbElement => + { + verbElement.Should().ContainPath("parameters").With(parametersElement => + { + parametersElement.EnumerateArray().Should().NotContain(element => element.GetProperty("in").ValueEquals("query")); + }); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/MsvOffStartup.cs b/test/OpenApiTests/ResourceFieldValidation/MsvOffStartup.cs new file mode 100644 index 0000000000..838803f9c4 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/MsvOffStartup.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Configuration; +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceFieldValidation; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +public sealed class MsvOffStartup : OpenApiStartup + where TDbContext : TestableDbContext +{ + protected override void SetJsonApiOptions(JsonApiOptions options) + { + base.SetJsonApiOptions(options); + + options.ValidateModelState = false; + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..541a5901ba --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3955 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/resources": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources.", + "operationId": "getResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resources, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/resourceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Creates a new resource.", + "operationId": "postResource", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The resource was successfully created, which resulted in additional changes. The newly created resource is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created resource can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier.", + "operationId": "getResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resource.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Updates an existing resource.", + "operationId": "patchResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Deletes an existing resource by its identifier.", + "operationId": "deleteResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The resource was successfully deleted." + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "postResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "patchResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the requiredToMany relationship of an individual resource.", + "operationId": "deleteResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredToOne relationship.", + "operationId": "getResourceRequiredToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredToOne relationship.", + "operationId": "getResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the requiredToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredToOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship.", + "operationId": "getResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship.", + "operationId": "getResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the toMany relationship of an individual resource.", + "operationId": "postResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the toMany relationship of an individual resource.", + "operationId": "patchResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the toMany relationship of an individual resource.", + "operationId": "deleteResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's toOne relationship.", + "operationId": "getResourceToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's toOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's toOne relationship.", + "operationId": "getResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's toOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the toOne relationship of an individual resource.", + "operationId": "patchResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the toOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "requiredNullableValueType", + "requiredReferenceType", + "requiredValueType" + ], + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyResourceType": { + "enum": [ + "empties" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableEmptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "requiredToMany", + "requiredToOne" + ], + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResourceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, + "toManyEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs new file mode 100644 index 0000000000..aae027360a --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/NullabilityTests.cs @@ -0,0 +1,102 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +public sealed class NullabilityTests : IClassFixture, NrtOffDbContext>> +{ + private readonly OpenApiTestContext, NrtOffDbContext> _testContext; + + public NullabilityTests(OpenApiTestContext, NrtOffDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("referenceType")] + [InlineData("requiredReferenceType")] + [InlineData("nullableValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True)); + }); + }); + } + + [Theory] + [InlineData("valueType")] + [InlineData("requiredValueType")] + public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().NotContainPath("nullable"); + }); + }); + } + + [Theory] + [InlineData("toOne")] + [InlineData("requiredToOne")] + public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.Should().Be(true)); + }); + }); + }); + } + + [Theory] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().NotContainPath("nullable"); + }); + }); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs new file mode 100644 index 0000000000..ece2c6174a --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOff/RequiredTests.cs @@ -0,0 +1,112 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOff; + +public sealed class RequiredTests : IClassFixture, NrtOffDbContext>> +{ + private readonly OpenApiTestContext, NrtOffDbContext> _testContext; + + public RequiredTests(OpenApiTestContext, NrtOffDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Theory] + [InlineData("requiredReferenceType")] + [InlineData("requiredValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("referenceType")] + [InlineData("valueType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("requiredToOne")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("toOne")] + [InlineData("toMany")] + public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Fact] + public async Task No_attribute_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); + } + + [Fact] + public async Task No_relationship_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..cb83b19b17 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -0,0 +1,4065 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/resources": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources.", + "operationId": "getResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resources, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/resourceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Creates a new resource.", + "operationId": "postResource", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The resource was successfully created, which resulted in additional changes. The newly created resource is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created resource can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier.", + "operationId": "getResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resource.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Updates an existing resource.", + "operationId": "patchResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Deletes an existing resource by its identifier.", + "operationId": "deleteResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The resource was successfully deleted." + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "postResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "patchResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the requiredToMany relationship of an individual resource.", + "operationId": "deleteResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredToOne relationship.", + "operationId": "getResourceRequiredToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredToOne relationship.", + "operationId": "getResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the requiredToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship.", + "operationId": "getResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship.", + "operationId": "getResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the toMany relationship of an individual resource.", + "operationId": "postResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the toMany relationship of an individual resource.", + "operationId": "patchResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the toMany relationship of an individual resource.", + "operationId": "deleteResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's toOne relationship.", + "operationId": "getResourceToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's toOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's toOne relationship.", + "operationId": "getResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's toOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the toOne relationship of an individual resource.", + "operationId": "patchResourceToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the toOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "requiredNullableValueType", + "requiredReferenceType" + ], + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "referenceType": { + "type": "string", + "nullable": true + }, + "requiredReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyResourceType": { + "enum": [ + "empties" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableEmptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "requiredToOne" + ], + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "toOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResourceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs new file mode 100644 index 0000000000..32c9e93779 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/NullabilityTests.cs @@ -0,0 +1,102 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +public sealed class NullabilityTests : IClassFixture, NrtOffDbContext>> +{ + private readonly OpenApiTestContext, NrtOffDbContext> _testContext; + + public NullabilityTests(OpenApiTestContext, NrtOffDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("referenceType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True)); + }); + }); + } + + [Theory] + [InlineData("requiredReferenceType")] + [InlineData("valueType")] + [InlineData("requiredValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().NotContainPath("nullable"); + }); + }); + } + + [Theory] + [InlineData("toOne")] + public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.Should().Be(true)); + }); + }); + }); + } + + [Theory] + [InlineData("requiredToOne")] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().NotContainPath("nullable"); + }); + }); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs new file mode 100644 index 0000000000..46a45ac2fd --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/ModelStateValidationOn/RequiredTests.cs @@ -0,0 +1,112 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff.ModelStateValidationOn; + +public sealed class RequiredTests : IClassFixture, NrtOffDbContext>> +{ + private readonly OpenApiTestContext, NrtOffDbContext> _testContext; + + public RequiredTests(OpenApiTestContext, NrtOffDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Theory] + [InlineData("requiredReferenceType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("referenceType")] + [InlineData("valueType")] + [InlineData("requiredValueType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("requiredToOne")] + public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("toOne")] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Fact] + public async Task No_attribute_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); + } + + [Fact] + public async Task No_relationship_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffDbContext.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffDbContext.cs new file mode 100644 index 0000000000..15d0cb0b96 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffDbContext.cs @@ -0,0 +1,40 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff; + +// @formatter:wrap_chained_method_calls chop_always + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class NrtOffDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Resources => Set(); + public DbSet Empties => Set(); + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasOne(resource => resource.ToOne) + .WithOne() + .HasForeignKey("ToOneId"); + + builder.Entity() + .HasOne(resource => resource.RequiredToOne) + .WithOne() + .HasForeignKey("RequiredToOneId"); + + builder.Entity() + .HasMany(resource => resource.ToMany) + .WithOne() + .HasForeignKey("ToManyId"); + + builder.Entity() + .HasMany(resource => resource.RequiredToMany) + .WithOne() + .HasForeignKey("RequiredToManyId"); + + base.OnModelCreating(builder); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffEmpty.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffEmpty.cs new file mode 100644 index 0000000000..a64fd34af5 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffEmpty.cs @@ -0,0 +1,11 @@ +#nullable disable + +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +[Resource(PublicName = "empties", ControllerNamespace = "OpenApiTests.ResourceFieldValidation")] +public class NrtOffEmpty : Identifiable; diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffResource.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffResource.cs new file mode 100644 index 0000000000..968d579d49 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOff/NrtOffResource.cs @@ -0,0 +1,48 @@ +#nullable disable + +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOff; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(PublicName = "resources", ControllerNamespace = "OpenApiTests.ResourceFieldValidation")] +public sealed class NrtOffResource : Identifiable +{ + [Attr] + public string ReferenceType { get; set; } + + [Attr] + [Required] + public string RequiredReferenceType { get; set; } + + [Attr] + public int ValueType { get; set; } + + [Attr] + [Required] + public int RequiredValueType { get; set; } + + [Attr] + public int? NullableValueType { get; set; } + + [Attr] + [Required] + public int? RequiredNullableValueType { get; set; } + + [HasOne] + public NrtOffEmpty ToOne { get; set; } + + [Required] + [HasOne] + public NrtOffEmpty RequiredToOne { get; set; } + + [HasMany] + public ICollection ToMany { get; set; } = new HashSet(); + + [Required] + [HasMany] + public ICollection RequiredToMany { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..1b962dc499 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5010 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/resources": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources.", + "operationId": "getResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resources, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/resourceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Creates a new resource.", + "operationId": "postResource", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The resource was successfully created, which resulted in additional changes. The newly created resource is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created resource can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier.", + "operationId": "getResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resource.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Updates an existing resource.", + "operationId": "patchResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Deletes an existing resource by its identifier.", + "operationId": "deleteResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The resource was successfully deleted." + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/nonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nonNullableToOne relationship.", + "operationId": "getResourceNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/nonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nonNullableToOne relationship.", + "operationId": "getResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the nonNullableToOne relationship of an individual resource.", + "operationId": "patchResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose nonNullableToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the nonNullableToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nonNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/nullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nullableToOne relationship.", + "operationId": "getResourceNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/nullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nullableToOne relationship.", + "operationId": "getResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the nullableToOne relationship of an individual resource.", + "operationId": "patchResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose nullableToOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the nullableToOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredNonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNonNullableToOne relationship.", + "operationId": "getResourceRequiredNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredNonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNonNullableToOne relationship.", + "operationId": "getResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the requiredNonNullableToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredNonNullableToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredNonNullableToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredNonNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNullableToOne relationship.", + "operationId": "getResourceRequiredNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNullableToOne relationship.", + "operationId": "getResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the requiredNullableToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredNullableToOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredNullableToOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "postResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "patchResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the requiredToMany relationship of an individual resource.", + "operationId": "deleteResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship.", + "operationId": "getResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship.", + "operationId": "getResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the toMany relationship of an individual resource.", + "operationId": "postResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the toMany relationship of an individual resource.", + "operationId": "patchResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the toMany relationship of an individual resource.", + "operationId": "deleteResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "requiredNonNullableReferenceType", + "requiredNullableReferenceType", + "requiredNullableValueType", + "requiredValueType" + ], + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyResourceType": { + "enum": [ + "empties" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableEmptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "requiredNonNullableToOne", + "requiredNullableToOne", + "requiredToMany" + ], + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResourceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs new file mode 100644 index 0000000000..084cb85fde --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/NullabilityTests.cs @@ -0,0 +1,106 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +public sealed class NullabilityTests : IClassFixture, NrtOnDbContext>> +{ + private readonly OpenApiTestContext, NrtOnDbContext> _testContext; + + public NullabilityTests(OpenApiTestContext, NrtOnDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("nullableReferenceType")] + [InlineData("requiredNullableReferenceType")] + [InlineData("nullableValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True)); + }); + }); + } + + [Theory] + [InlineData("nonNullableReferenceType")] + [InlineData("requiredNonNullableReferenceType")] + [InlineData("valueType")] + [InlineData("requiredValueType")] + public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().NotContainPath("nullable"); + }); + }); + } + + [Theory] + [InlineData("nullableToOne")] + [InlineData("requiredNullableToOne")] + public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.Should().Be(true)); + }); + }); + }); + } + + [Theory] + [InlineData("nonNullableToOne")] + [InlineData("requiredNonNullableToOne")] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().NotContainPath("nullable"); + }); + }); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs new file mode 100644 index 0000000000..64ee1c433e --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOff/RequiredTests.cs @@ -0,0 +1,116 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOff; + +public sealed class RequiredTests : IClassFixture, NrtOnDbContext>> +{ + private readonly OpenApiTestContext, NrtOnDbContext> _testContext; + + public RequiredTests(OpenApiTestContext, NrtOnDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Theory] + [InlineData("requiredNonNullableReferenceType")] + [InlineData("requiredNullableReferenceType")] + [InlineData("requiredValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("nonNullableReferenceType")] + [InlineData("nullableReferenceType")] + [InlineData("valueType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("requiredNonNullableToOne")] + [InlineData("requiredNullableToOne")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("nonNullableToOne")] + [InlineData("nullableToOne")] + [InlineData("toMany")] + public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Fact] + public async Task No_attribute_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); + } + + [Fact] + public async Task No_relationship_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..0717249aa5 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5004 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/resources": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources.", + "operationId": "getResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resources, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/resourceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves a collection of resources without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Creates a new resource.", + "operationId": "postResource", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The resource was successfully created, which resulted in additional changes. The newly created resource is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created resource can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier.", + "operationId": "getResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found resource.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves an individual resource by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Updates an existing resource.", + "operationId": "patchResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the resource to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResourceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The resource was successfully updated, which resulted in additional changes. The updated resource is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResourceResponseDocument" + } + } + } + }, + "204": { + "description": "The resource was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Deletes an existing resource by its identifier.", + "operationId": "deleteResource", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "The resource was successfully deleted." + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/nonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nonNullableToOne relationship.", + "operationId": "getResourceNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/nonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nonNullableToOne relationship.", + "operationId": "getResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the nonNullableToOne relationship of an individual resource.", + "operationId": "patchResourceNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose nonNullableToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the nonNullableToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nonNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/nullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nullableToOne relationship.", + "operationId": "getResourceNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's nullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/nullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nullableToOne relationship.", + "operationId": "getResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableEmptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's nullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Clears or assigns an existing empty to the nullableToOne relationship of an individual resource.", + "operationId": "patchResourceNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose nullableToOne relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the nullableToOne relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The nullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredNonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNonNullableToOne relationship.", + "operationId": "getResourceRequiredNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNonNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredNonNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNonNullableToOne relationship.", + "operationId": "getResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNonNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the requiredNonNullableToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredNonNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredNonNullableToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredNonNullableToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredNonNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNullableToOne relationship.", + "operationId": "getResourceRequiredNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryEmptyResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty of an individual resource's requiredNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNullableToOne", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredNullableToOne": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNullableToOne relationship.", + "operationId": "getResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identity of an individual resource's requiredNullableToOne relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns an existing empty to the requiredNullableToOne relationship of an individual resource.", + "operationId": "patchResourceRequiredNullableToOneRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredNullableToOne relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identity of the empty to assign to the requiredNullableToOne relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredNullableToOne relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/requiredToMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship.", + "operationId": "getResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's requiredToMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "postResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the requiredToMany relationship of an individual resource.", + "operationId": "patchResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose requiredToMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the requiredToMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The requiredToMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the requiredToMany relationship of an individual resource.", + "operationId": "deleteResourceRequiredToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the requiredToMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/resources/{id}/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship.", + "operationId": "getResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empties, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empties of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToMany", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empties to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + } + }, + "/resources/{id}/relationships/toMany": { + "get": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship.", + "operationId": "getResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found empty identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/emptyIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "resources" + ], + "summary": "Retrieves the related empty identities of an individual resource's toMany relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose related empty identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The resource does not exist." + } + } + }, + "post": { + "tags": [ + "resources" + ], + "summary": "Adds existing empties to the toMany relationship of an individual resource.", + "operationId": "postResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to add empties to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to add to the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "resources" + ], + "summary": "Assigns existing empties to the toMany relationship of an individual resource.", + "operationId": "patchResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource whose toMany relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to assign to the toMany relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The toMany relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "resources" + ], + "summary": "Removes existing empties from the toMany relationship of an individual resource.", + "operationId": "deleteResourceToManyRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the resource to remove empties from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int32" + } + } + ], + "requestBody": { + "description": "The identities of the empties to remove from the toMany relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The empties were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "nonNullableReferenceType", + "requiredNonNullableReferenceType", + "requiredNullableReferenceType", + "requiredNullableValueType" + ], + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInResourceResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/attributesInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableReferenceType": { + "type": "string" + }, + "requiredNonNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "nullableReferenceType": { + "type": "string", + "nullable": true + }, + "requiredNullableReferenceType": { + "minLength": 1, + "type": "string" + }, + "valueType": { + "type": "integer", + "format": "int32" + }, + "requiredValueType": { + "type": "integer", + "format": "int32" + }, + "nullableValueType": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "requiredNullableValueType": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInEmptyResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResourceResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResourceResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResourceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResourceRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "emptyIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int32" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "emptyResourceType": { + "enum": [ + "empties" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableEmptyIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResourceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResourceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "nonNullableToOne", + "requiredNonNullableToOne", + "requiredNullableToOne" + ], + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResourceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInResponse" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInResponse" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInResourceResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "resources": "#/components/schemas/relationshipsInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResourceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "nonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "requiredNonNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "nullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneEmptyInRequest" + } + ] + }, + "requiredNullableToOne": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneEmptyInRequest" + } + ] + }, + "toMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + }, + "requiredToMany": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyEmptyInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResourceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInCreateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "empties": "#/components/schemas/dataInEmptyResponse", + "resources": "#/components/schemas/dataInResourceResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "resources": "#/components/schemas/dataInUpdateResourceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "empties", + "resources" + ], + "type": "string" + }, + "secondaryEmptyResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInEmptyResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneEmptyInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/emptyIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResourceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResourceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs new file mode 100644 index 0000000000..8617f3cd28 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/NullabilityTests.cs @@ -0,0 +1,106 @@ +using System.Text.Json; +using FluentAssertions; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +public sealed class NullabilityTests : IClassFixture, NrtOnDbContext>> +{ + private readonly OpenApiTestContext, NrtOnDbContext> _testContext; + + public NullabilityTests(OpenApiTestContext, NrtOnDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData("nullableReferenceType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.ValueKind.Should().Be(JsonValueKind.True)); + }); + }); + } + + [Theory] + [InlineData("nonNullableReferenceType")] + [InlineData("requiredNonNullableReferenceType")] + [InlineData("requiredNullableReferenceType")] + [InlineData("valueType")] + [InlineData("requiredValueType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInResourceResponse.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath(jsonPropertyName).With(schemaProperty => + { + schemaProperty.Should().NotContainPath("nullable"); + }); + }); + } + + [Theory] + [InlineData("nullableToOne")] + public async Task Schema_property_for_relationship_is_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().ContainPath("nullable").With(nullableProperty => nullableProperty.Should().Be(true)); + }); + }); + }); + } + + [Theory] + [InlineData("nonNullableToOne")] + [InlineData("requiredNonNullableToOne")] + [InlineData("requiredNullableToOne")] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_nullable(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1].properties").With(schemaProperties => + { + schemaProperties.Should().ContainPath($"{jsonPropertyName}.allOf[0].$ref").WithSchemaReferenceId(schemaReferenceId => + { + document.Should().ContainPath($"components.schemas.{schemaReferenceId}.properties.data").With(relationshipDataSchema => + { + relationshipDataSchema.Should().NotContainPath("nullable"); + }); + }); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs new file mode 100644 index 0000000000..ad70bcfdeb --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/ModelStateValidationOn/RequiredTests.cs @@ -0,0 +1,116 @@ +using System.Text.Json; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn.ModelStateValidationOn; + +public sealed class RequiredTests : IClassFixture, NrtOnDbContext>> +{ + private readonly OpenApiTestContext, NrtOnDbContext> _testContext; + + public RequiredTests(OpenApiTestContext, NrtOnDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + } + + [Theory] + [InlineData("nonNullableReferenceType")] + [InlineData("requiredNonNullableReferenceType")] + [InlineData("requiredNullableReferenceType")] + [InlineData("requiredNullableValueType")] + public async Task Schema_property_for_attribute_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("nullableReferenceType")] + [InlineData("valueType")] + [InlineData("requiredValueType")] + [InlineData("nullableValueType")] + public async Task Schema_property_for_attribute_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInCreateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + attributesSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("nonNullableToOne")] + [InlineData("requiredNonNullableToOne")] + [InlineData("requiredNullableToOne")] + public async Task Schema_property_for_relationship_is_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().ContainArrayElement(jsonPropertyName)); + }); + } + + [Theory] + [InlineData("nullableToOne")] + [InlineData("toMany")] + [InlineData("requiredToMany")] + public async Task Schema_property_for_relationship_is_not_required_for_creating_resource(string jsonPropertyName) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInCreateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().ContainPath($"properties.{jsonPropertyName}"); + relationshipsSchema.Should().ContainPath("required").With(propertySet => propertySet.Should().NotContainArrayElement(jsonPropertyName)); + }); + } + + [Fact] + public async Task No_attribute_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.attributesInUpdateResourceRequest.allOf[1]").With(attributesSchema => + { + attributesSchema.Should().NotContainPath("required"); + }); + } + + [Fact] + public async Task No_relationship_schema_properties_are_required_for_updating_resource() + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + document.Should().ContainPath("components.schemas.relationshipsInUpdateResourceRequest.allOf[1]").With(relationshipsSchema => + { + relationshipsSchema.Should().NotContainPath("required"); + }); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnDbContext.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnDbContext.cs new file mode 100644 index 0000000000..2a75814ced --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnDbContext.cs @@ -0,0 +1,50 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn; + +// @formatter:wrap_chained_method_calls chop_always + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class NrtOnDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Resources => Set(); + public DbSet Empties => Set(); + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasOne(resource => resource.NonNullableToOne) + .WithOne() + .HasForeignKey("NonNullableToOneId"); + + builder.Entity() + .HasOne(resource => resource.RequiredNonNullableToOne) + .WithOne() + .HasForeignKey("RequiredNonNullableToOneId"); + + builder.Entity() + .HasOne(resource => resource.NullableToOne) + .WithOne() + .HasForeignKey("NullableToOneId"); + + builder.Entity() + .HasOne(resource => resource.RequiredNullableToOne) + .WithOne() + .HasForeignKey("RequiredNullableToOneId"); + + builder.Entity() + .HasMany(resource => resource.ToMany) + .WithOne() + .HasForeignKey("ToManyId"); + + builder.Entity() + .HasMany(resource => resource.RequiredToMany) + .WithOne() + .HasForeignKey("RequiredToManyId"); + + base.OnModelCreating(builder); + } +} diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnEmpty.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnEmpty.cs new file mode 100644 index 0000000000..259cfda06e --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnEmpty.cs @@ -0,0 +1,9 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn; + +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] +[Resource(PublicName = "empties", ControllerNamespace = "OpenApiTests.ResourceFieldValidation")] +public class NrtOnEmpty : Identifiable; diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs new file mode 100644 index 0000000000..efc897cea2 --- /dev/null +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs @@ -0,0 +1,60 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(PublicName = "resources", ControllerNamespace = "OpenApiTests.ResourceFieldValidation")] +public sealed class NrtOnResource : Identifiable +{ + [Attr] + public string NonNullableReferenceType { get; set; } = null!; + + [Attr] + [Required] + public string RequiredNonNullableReferenceType { get; set; } = null!; + + [Attr] + public string? NullableReferenceType { get; set; } + + [Attr] + [Required] + public string? RequiredNullableReferenceType { get; set; } + + [Attr] + public int ValueType { get; set; } + + [Attr] + [Required] + public int RequiredValueType { get; set; } + + [Attr] + public int? NullableValueType { get; set; } + + [Attr] + [Required] + public int? RequiredNullableValueType { get; set; } + + [HasOne] + public NrtOnEmpty NonNullableToOne { get; set; } = null!; + + [Required] + [HasOne] + public NrtOnEmpty RequiredNonNullableToOne { get; set; } = null!; + + [HasOne] + public NrtOnEmpty? NullableToOne { get; set; } + + [Required] + [HasOne] + public NrtOnEmpty? RequiredNullableToOne { get; set; } + + [HasMany] + public ICollection ToMany { get; set; } = new HashSet(); + + [Required] + [HasMany] + public ICollection RequiredToMany { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs new file mode 100644 index 0000000000..09ff3fb81a --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Everything/EverythingInheritanceTests.cs @@ -0,0 +1,338 @@ +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.Everything; + +public sealed class EverythingInheritanceTests( + OpenApiTestContext, ResourceInheritanceDbContext> testContext, ITestOutputHelper testOutputHelper) + : ResourceInheritanceTests(testContext, testOutputHelper, true, false) +{ + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs b/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs new file mode 100644 index 0000000000..1b67bd24b1 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Bathroom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Bathroom : Room +{ + [Attr] + [Required] + public bool? HasBath { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs b/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs new file mode 100644 index 0000000000..3cf0a22e11 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Bedroom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Bedroom : Room +{ + [Attr] + [Required] + public int? BedCount { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Building.cs b/test/OpenApiTests/ResourceInheritance/Models/Building.cs new file mode 100644 index 0000000000..361a3a374f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Building.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public abstract class Building : Identifiable +{ + [Attr] + [Required] + public int? SurfaceInSquareMeters { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs b/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs new file mode 100644 index 0000000000..e282e47306 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/CyclePath.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class CyclePath : Road +{ + [Attr] + public bool HasLaneForPedestrians { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/District.cs b/test/OpenApiTests/ResourceInheritance/Models/District.cs new file mode 100644 index 0000000000..3ef752e386 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/District.cs @@ -0,0 +1,19 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class District : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; + + [HasMany] + public ISet Buildings { get; set; } = new HashSet(); + + [HasMany] + public ISet Roads { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs b/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs new file mode 100644 index 0000000000..37533383c3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/FamilyHome.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class FamilyHome : Residence +{ + [Attr] + [Required] + public int FloorCount { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs b/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs new file mode 100644 index 0000000000..d20206fe7e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Kitchen.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Kitchen : Room +{ + [Attr] + [Required] + public bool? HasPantry { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs b/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs new file mode 100644 index 0000000000..467f5f5aa3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/LivingRoom.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class LivingRoom : Room +{ + [Attr] + [Required] + public bool? HasDiningTable { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs new file mode 100644 index 0000000000..acf87c8eee --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Mansion : Residence +{ + [Attr] + public string OwnerName { get; set; } = null!; + + [HasMany] + public ISet Staff { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Residence.cs b/test/OpenApiTests/ResourceInheritance/Models/Residence.cs new file mode 100644 index 0000000000..fa6ca835cf --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Residence.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public class Residence : Building +{ + [Attr] + [Required] + public int? NumberOfResidents { get; set; } + + [HasMany] + public ISet Rooms { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Road.cs b/test/OpenApiTests/ResourceInheritance/Models/Road.cs new file mode 100644 index 0000000000..c89d7a5d4b --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Road.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public class Road : Identifiable +{ + [Attr] + public decimal LengthInMeters { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Room.cs b/test/OpenApiTests/ResourceInheritance/Models/Room.cs new file mode 100644 index 0000000000..6cf38598b7 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Room.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public abstract class Room : Identifiable +{ + [Attr] + [Required] + public int? SurfaceInSquareMeters { get; set; } + + [HasOne] + public Residence Residence { get; set; } = null!; +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs new file mode 100644 index 0000000000..0baa95db7e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class StaffMember : Identifiable +{ + [Attr] + public string Name { get; set; } = null!; +} diff --git a/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs b/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs new file mode 100644 index 0000000000..9cade078ec --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/Models/Toilet.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.ResourceInheritance.Models; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.ResourceInheritance")] +public sealed class Toilet : Room +{ + [Attr] + [Required] + public bool? HasSink { get; set; } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..9dad8a07cb --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/GeneratedSwagger/swagger.g.json @@ -0,0 +1,20013 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/bathrooms": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves a collection of bathrooms.", + "operationId": "getBathroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bathrooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/bathroomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves a collection of bathrooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "bathrooms" + ], + "summary": "Creates a new bathroom.", + "operationId": "postBathroom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bathroom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBathroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The bathroom was successfully created, which resulted in additional changes. The newly created bathroom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created bathroom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bathroom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bathrooms/{id}": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves an individual bathroom by its identifier.", + "operationId": "getBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bathroom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves an individual bathroom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Updates an existing bathroom.", + "operationId": "patchBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bathroom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBathroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The bathroom was successfully updated, which resulted in additional changes. The updated bathroom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBathroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bathroom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "bathrooms" + ], + "summary": "Deletes an existing bathroom by its identifier.", + "operationId": "deleteBathroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The bathroom was successfully deleted." + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bathrooms/{id}/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + } + }, + "/bathrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bathroom.", + "operationId": "patchBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves a collection of bedrooms.", + "operationId": "getBedroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bedrooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/bedroomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves a collection of bedrooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "bedrooms" + ], + "summary": "Creates a new bedroom.", + "operationId": "postBedroom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bedroom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBedroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The bedroom was successfully created, which resulted in additional changes. The newly created bedroom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created bedroom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bedroom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves an individual bedroom by its identifier.", + "operationId": "getBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found bedroom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves an individual bedroom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Updates an existing bedroom.", + "operationId": "patchBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the bedroom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBedroomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The bedroom was successfully updated, which resulted in additional changes. The updated bedroom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBedroomResponseDocument" + } + } + } + }, + "204": { + "description": "The bedroom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "bedrooms" + ], + "summary": "Deletes an existing bedroom by its identifier.", + "operationId": "deleteBedroom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The bedroom was successfully deleted." + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + } + }, + "/bedrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bedroom.", + "operationId": "patchBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings": { + "get": { + "tags": [ + "buildings" + ], + "summary": "Retrieves a collection of buildings.", + "operationId": "getBuildingCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found buildings, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "buildings" + ], + "summary": "Retrieves a collection of buildings without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBuildingCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "buildings" + ], + "summary": "Creates a new building.", + "operationId": "postBuilding", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The building was successfully created, which resulted in additional changes. The newly created building is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created building can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings/{id}": { + "get": { + "tags": [ + "buildings" + ], + "summary": "Retrieves an individual building by its identifier.", + "operationId": "getBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "buildings" + ], + "summary": "Retrieves an individual building by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The building does not exist." + } + } + }, + "patch": { + "tags": [ + "buildings" + ], + "summary": "Updates an existing building.", + "operationId": "patchBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The building was successfully updated, which resulted in additional changes. The updated building is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "buildings" + ], + "summary": "Deletes an existing building by its identifier.", + "operationId": "deleteBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The building was successfully deleted." + }, + "404": { + "description": "The building does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves a collection of cyclePaths.", + "operationId": "getCyclePathCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePaths, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/cyclePathCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves a collection of cyclePaths without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePathCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "cyclePaths" + ], + "summary": "Creates a new cyclePath.", + "operationId": "postCyclePath", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the cyclePath to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createCyclePathRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The cyclePath was successfully created, which resulted in additional changes. The newly created cyclePath is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created cyclePath can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "204": { + "description": "The cyclePath was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths/{id}": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier.", + "operationId": "getCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePath.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The cyclePath does not exist." + } + } + }, + "patch": { + "tags": [ + "cyclePaths" + ], + "summary": "Updates an existing cyclePath.", + "operationId": "patchCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the cyclePath to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateCyclePathRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The cyclePath was successfully updated, which resulted in additional changes. The updated cyclePath is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "204": { + "description": "The cyclePath was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "cyclePaths" + ], + "summary": "Deletes an existing cyclePath by its identifier.", + "operationId": "deleteCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The cyclePath was successfully deleted." + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts.", + "operationId": "getDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found districts, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/districtCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Creates a new district.", + "operationId": "postDistrict", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the district to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createDistrictRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The district was successfully created, which resulted in additional changes. The newly created district is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created district can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "204": { + "description": "The district was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves an individual district by its identifier.", + "operationId": "getDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found district.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves an individual district by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Updates an existing district.", + "operationId": "patchDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the district to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateDistrictRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The district was successfully updated, which resulted in additional changes. The updated district is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDistrictResponseDocument" + } + } + } + }, + "204": { + "description": "The district was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Deletes an existing district by its identifier.", + "operationId": "deleteDistrict", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "204": { + "description": "The district was successfully deleted." + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related buildings of an individual district's buildings relationship.", + "operationId": "getDistrictBuildings", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related buildings to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found buildings, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related buildings of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildings", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related buildings to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + } + }, + "/districts/{id}/relationships/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship.", + "operationId": "getDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing buildings to the buildings relationship of an individual district.", + "operationId": "postDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add buildings to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to add to the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing buildings to the buildings relationship of an individual district.", + "operationId": "patchDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose buildings relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to assign to the buildings relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing buildings from the buildings relationship of an individual district.", + "operationId": "deleteDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove buildings from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to remove from the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related roads of an individual district's roads relationship.", + "operationId": "getDistrictRoads", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related roads to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found roads, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related roads of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoads", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related roads to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + } + }, + "/districts/{id}/relationships/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship.", + "operationId": "getDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing roads to the roads relationship of an individual district.", + "operationId": "postDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add roads to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to add to the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing roads to the roads relationship of an individual district.", + "operationId": "patchDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose roads relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to assign to the roads relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing roads from the roads relationship of an individual district.", + "operationId": "deleteDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove roads from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to remove from the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves a collection of familyHomes.", + "operationId": "getFamilyHomeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found familyHomes, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/familyHomeCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves a collection of familyHomes without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Creates a new familyHome.", + "operationId": "postFamilyHome", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the familyHome to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createFamilyHomeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The familyHome was successfully created, which resulted in additional changes. The newly created familyHome is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created familyHome can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "204": { + "description": "The familyHome was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves an individual familyHome by its identifier.", + "operationId": "getFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found familyHome.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves an individual familyHome by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Updates an existing familyHome.", + "operationId": "patchFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the familyHome to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateFamilyHomeRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The familyHome was successfully updated, which resulted in additional changes. The updated familyHome is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryFamilyHomeResponseDocument" + } + } + } + }, + "204": { + "description": "The familyHome was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Deletes an existing familyHome by its identifier.", + "operationId": "deleteFamilyHome", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The familyHome was successfully deleted." + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related rooms of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related rooms of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "postFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "patchFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual familyHome.", + "operationId": "deleteFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves a collection of kitchens.", + "operationId": "getKitchenCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found kitchens, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/kitchenCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves a collection of kitchens without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "kitchens" + ], + "summary": "Creates a new kitchen.", + "operationId": "postKitchen", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the kitchen to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createKitchenRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The kitchen was successfully created, which resulted in additional changes. The newly created kitchen is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created kitchen can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "204": { + "description": "The kitchen was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves an individual kitchen by its identifier.", + "operationId": "getKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found kitchen.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves an individual kitchen by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Updates an existing kitchen.", + "operationId": "patchKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the kitchen to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateKitchenRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The kitchen was successfully updated, which resulted in additional changes. The updated kitchen is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryKitchenResponseDocument" + } + } + } + }, + "204": { + "description": "The kitchen was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "kitchens" + ], + "summary": "Deletes an existing kitchen by its identifier.", + "operationId": "deleteKitchen", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The kitchen was successfully deleted." + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + } + }, + "/kitchens/{id}/relationships/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual kitchen.", + "operationId": "patchKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves a collection of livingRooms.", + "operationId": "getLivingRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found livingRooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/livingRoomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves a collection of livingRooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "livingRooms" + ], + "summary": "Creates a new livingRoom.", + "operationId": "postLivingRoom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the livingRoom to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createLivingRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The livingRoom was successfully created, which resulted in additional changes. The newly created livingRoom is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created livingRoom can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The livingRoom was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves an individual livingRoom by its identifier.", + "operationId": "getLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found livingRoom.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves an individual livingRoom by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Updates an existing livingRoom.", + "operationId": "patchLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the livingRoom to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateLivingRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The livingRoom was successfully updated, which resulted in additional changes. The updated livingRoom is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryLivingRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The livingRoom was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "livingRooms" + ], + "summary": "Deletes an existing livingRoom by its identifier.", + "operationId": "deleteLivingRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The livingRoom was successfully deleted." + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + } + }, + "/livingRooms/{id}/relationships/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual livingRoom.", + "operationId": "patchLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves a collection of mansions.", + "operationId": "getMansionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found mansions, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/mansionCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves a collection of mansions without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Creates a new mansion.", + "operationId": "postMansion", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the mansion to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createMansionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The mansion was successfully created, which resulted in additional changes. The newly created mansion is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created mansion can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "204": { + "description": "The mansion was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves an individual mansion by its identifier.", + "operationId": "getMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found mansion.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves an individual mansion by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Updates an existing mansion.", + "operationId": "patchMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the mansion to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateMansionRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The mansion was successfully updated, which resulted in additional changes. The updated mansion is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryMansionResponseDocument" + } + } + } + }, + "204": { + "description": "The mansion was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Deletes an existing mansion by its identifier.", + "operationId": "deleteMansion", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The mansion was successfully deleted." + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related rooms of an individual mansion's rooms relationship.", + "operationId": "getMansionRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related rooms of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + } + }, + "/mansions/{id}/relationships/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship.", + "operationId": "getMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual mansion.", + "operationId": "postMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual mansion.", + "operationId": "patchMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual mansion.", + "operationId": "deleteMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMembers of an individual mansion's staff relationship.", + "operationId": "getMansionStaff", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMembers of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaff", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMembers to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + } + }, + "/mansions/{id}/relationships/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship.", + "operationId": "getMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "postMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add staffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to add to the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "patchMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose staff relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to assign to the staff relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing staffMembers from the staff relationship of an individual mansion.", + "operationId": "deleteMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove staffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to remove from the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves a collection of residences.", + "operationId": "getResidenceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residences, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves a collection of residences without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Creates a new residence.", + "operationId": "postResidence", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the residence to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The residence was successfully created, which resulted in additional changes. The newly created residence is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created residence can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "204": { + "description": "The residence was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves an individual residence by its identifier.", + "operationId": "getResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves an individual residence by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Updates an existing residence.", + "operationId": "patchResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the residence to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The residence was successfully updated, which resulted in additional changes. The updated residence is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryResidenceResponseDocument" + } + } + } + }, + "204": { + "description": "The residence was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Deletes an existing residence by its identifier.", + "operationId": "deleteResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The residence was successfully deleted." + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related rooms of an individual residence's rooms relationship.", + "operationId": "getResidenceRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related rooms of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRooms", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related rooms to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + } + }, + "/residences/{id}/relationships/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship.", + "operationId": "getResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual residence.", + "operationId": "postResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual residence.", + "operationId": "patchResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual residence.", + "operationId": "deleteResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/roads": { + "get": { + "tags": [ + "roads" + ], + "summary": "Retrieves a collection of roads.", + "operationId": "getRoadCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found roads, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "roads" + ], + "summary": "Retrieves a collection of roads without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoadCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "roads" + ], + "summary": "Creates a new road.", + "operationId": "postRoad", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the road to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoadRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The road was successfully created, which resulted in additional changes. The newly created road is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created road can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "204": { + "description": "The road was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/roads/{id}": { + "get": { + "tags": [ + "roads" + ], + "summary": "Retrieves an individual road by its identifier.", + "operationId": "getRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The road does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "roads" + ], + "summary": "Retrieves an individual road by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The road does not exist." + } + } + }, + "patch": { + "tags": [ + "roads" + ], + "summary": "Updates an existing road.", + "operationId": "patchRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the road to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoadRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The road was successfully updated, which resulted in additional changes. The updated road is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoadResponseDocument" + } + } + } + }, + "204": { + "description": "The road was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The road or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "roads" + ], + "summary": "Deletes an existing road by its identifier.", + "operationId": "deleteRoad", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the road to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The road was successfully deleted." + }, + "404": { + "description": "The road does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves a collection of rooms.", + "operationId": "getRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found rooms, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves a collection of rooms without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "rooms" + ], + "summary": "Creates a new room.", + "operationId": "postRoom", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the room to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The room was successfully created, which resulted in additional changes. The newly created room is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created room can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The room was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves an individual room by its identifier.", + "operationId": "getRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves an individual room by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Updates an existing room.", + "operationId": "patchRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the room to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The room was successfully updated, which resulted in additional changes. The updated room is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryRoomResponseDocument" + } + } + } + }, + "204": { + "description": "The room was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "rooms" + ], + "summary": "Deletes an existing room by its identifier.", + "operationId": "deleteRoom", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The room was successfully deleted." + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence of an individual room's residence relationship.", + "operationId": "getRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + } + }, + "/rooms/{id}/relationships/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship.", + "operationId": "getRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual room.", + "operationId": "patchRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers.", + "operationId": "getStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMembers, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves a collection of staffMembers without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMemberCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "staffMembers" + ], + "summary": "Creates a new staffMember.", + "operationId": "postStaffMember", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The staffMember was successfully created, which resulted in additional changes. The newly created staffMember is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created staffMember can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/staffMembers/{id}": { + "get": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier.", + "operationId": "getStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "staffMembers" + ], + "summary": "Retrieves an individual staffMember by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The staffMember does not exist." + } + } + }, + "patch": { + "tags": [ + "staffMembers" + ], + "summary": "Updates an existing staffMember.", + "operationId": "patchStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the staffMember to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateStaffMemberRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The staffMember was successfully updated, which resulted in additional changes. The updated staffMember is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryStaffMemberResponseDocument" + } + } + } + }, + "204": { + "description": "The staffMember was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The staffMember or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "staffMembers" + ], + "summary": "Deletes an existing staffMember by its identifier.", + "operationId": "deleteStaffMember", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the staffMember to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The staffMember was successfully deleted." + }, + "404": { + "description": "The staffMember does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves a collection of toilets.", + "operationId": "getToiletCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found toilets, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/toiletCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves a collection of toilets without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + }, + "post": { + "tags": [ + "toilets" + ], + "summary": "Creates a new toilet.", + "operationId": "postToilet", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the toilet to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createToiletRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The toilet was successfully created, which resulted in additional changes. The newly created toilet is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created toilet can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "204": { + "description": "The toilet was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves an individual toilet by its identifier.", + "operationId": "getToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found toilet.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves an individual toilet by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Updates an existing toilet.", + "operationId": "patchToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the toilet to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateToiletRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The toilet was successfully updated, which resulted in additional changes. The updated toilet is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryToiletResponseDocument" + } + } + } + }, + "204": { + "description": "The toilet was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "toilets" + ], + "summary": "Deletes an existing toilet by its identifier.", + "operationId": "deleteToilet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The toilet was successfully deleted." + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence of an individual toilet's residence relationship.", + "operationId": "getToiletResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryResidenceResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidence", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + } + }, + "/toilets/{id}/relationships/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship.", + "operationId": "getToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual toilet.", + "operationId": "patchToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator" + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasBath" + ], + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "bedCount" + ], + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoadRequest" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasPantry" + ], + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasDiningTable" + ], + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInCreateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInCreateBedroomRequest", + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/attributesInCreateCyclePathRequest", + "districts": "#/components/schemas/attributesInCreateDistrictRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInCreateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInCreateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest", + "roads": "#/components/schemas/attributesInCreateRoadRequest", + "rooms": "#/components/schemas/attributesInCreateRoomRequest", + "staffMembers": "#/components/schemas/attributesInCreateStaffMemberRequest", + "toilets": "#/components/schemas/attributesInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasSink" + ], + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse", + "districts": "#/components/schemas/attributesInDistrictResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "roads": "#/components/schemas/attributesInRoadResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoadRequest" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInUpdateBedroomRequest", + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/attributesInUpdateCyclePathRequest", + "districts": "#/components/schemas/attributesInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest", + "roads": "#/components/schemas/attributesInUpdateRoadRequest", + "rooms": "#/components/schemas/attributesInUpdateRoomRequest", + "staffMembers": "#/components/schemas/attributesInUpdateStaffMemberRequest", + "toilets": "#/components/schemas/attributesInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateStaffMemberRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBathroomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBedroomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBathroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBathroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createBedroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBedroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createCyclePathRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateCyclePathRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createDistrictRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateDistrictRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createFamilyHomeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateFamilyHomeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createKitchenRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateKitchenRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createLivingRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateLivingRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createMansionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateMansionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createResidenceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createRoadRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoadRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "createToiletRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateToiletRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateCyclePathRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateDistrictRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateDistrictRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateDistrictRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoadRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoadRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoadRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDistrictResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInDistrictResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/dataInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateCyclePathRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateDistrictRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateDistrictRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateDistrictRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateRoadRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoadRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoadRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateStaffMemberRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateStaffMemberRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInFamilyHomeResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "cyclePaths": "#/components/schemas/cyclePathIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "roads": "#/components/schemas/roadIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInKitchenResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInLivingRoomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInMansionResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBathroomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBathroomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBedroomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBedroomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryBuildingResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryCyclePathResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryDistrictResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryFamilyHomeResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInFamilyHomeResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryKitchenResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInKitchenResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryLivingRoomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInLivingRoomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryMansionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInMansionResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryResidenceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryRoadResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryRoomResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryStaffMemberResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryToiletResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInToiletResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInCreateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInCreateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/relationshipsInCreateCyclePathRequest", + "districts": "#/components/schemas/relationshipsInCreateDistrictRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInCreateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInCreateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest", + "roads": "#/components/schemas/relationshipsInCreateRoadRequest", + "rooms": "#/components/schemas/relationshipsInCreateRoomRequest", + "toilets": "#/components/schemas/relationshipsInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "residence" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInResponse" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse", + "districts": "#/components/schemas/relationshipsInDistrictResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "roads": "#/components/schemas/relationshipsInRoadResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateCyclePathRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoadRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateDistrictRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInUpdateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/relationshipsInUpdateCyclePathRequest", + "districts": "#/components/schemas/relationshipsInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest", + "roads": "#/components/schemas/relationshipsInUpdateRoadRequest", + "rooms": "#/components/schemas/relationshipsInUpdateRoomRequest", + "toilets": "#/components/schemas/relationshipsInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRoadRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "residenceIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInCreateBathroomRequest", + "bedrooms": "#/components/schemas/dataInCreateBedroomRequest", + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "cyclePaths": "#/components/schemas/dataInCreateCyclePathRequest", + "districts": "#/components/schemas/dataInCreateDistrictRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInCreateKitchenRequest", + "livingRooms": "#/components/schemas/dataInCreateLivingRoomRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest", + "roads": "#/components/schemas/dataInCreateRoadRequest", + "rooms": "#/components/schemas/dataInCreateRoomRequest", + "staffMembers": "#/components/schemas/dataInCreateStaffMemberRequest", + "toilets": "#/components/schemas/dataInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "cyclePaths": "#/components/schemas/dataInCyclePathResponse", + "districts": "#/components/schemas/dataInDistrictResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "roads": "#/components/schemas/dataInRoadResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInUpdateBathroomRequest", + "bedrooms": "#/components/schemas/dataInUpdateBedroomRequest", + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "cyclePaths": "#/components/schemas/dataInUpdateCyclePathRequest", + "districts": "#/components/schemas/dataInUpdateDistrictRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInUpdateKitchenRequest", + "livingRooms": "#/components/schemas/dataInUpdateLivingRoomRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest", + "roads": "#/components/schemas/dataInUpdateRoadRequest", + "rooms": "#/components/schemas/dataInUpdateRoomRequest", + "staffMembers": "#/components/schemas/dataInUpdateStaffMemberRequest", + "toilets": "#/components/schemas/dataInUpdateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "districts", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInRoadResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInRoomResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "secondaryResidenceResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInStaffMemberResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyBuildingInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInToiletResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBathroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateBedroomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBedroomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateCyclePathRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateCyclePathRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateDistrictRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateDistrictRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateFamilyHomeRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateFamilyHomeRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateKitchenRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateKitchenRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateLivingRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateLivingRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateMansionRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateMansionRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateResidenceRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateRoadRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoadRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateRoomRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateRoomRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateStaffMemberRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateStaffMemberRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateToiletRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateToiletRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs new file mode 100644 index 0000000000..5b2866d074 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return true; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs new file mode 100644 index 0000000000..c057fdacc7 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsInheritanceTests.cs @@ -0,0 +1,333 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsInheritanceTests : ResourceInheritanceTests +{ + public NoOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", "")] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", null)] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, null, null)] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, null, null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, null, null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs new file mode 100644 index 0000000000..4c4f63ef5e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/NoOperations/NoOperationsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.NoOperations; + +public sealed class NoOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs new file mode 100644 index 0000000000..29d20e0ab8 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +internal sealed class OnlyAbstractEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return resourceType.ClrType.IsAbstract; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs new file mode 100644 index 0000000000..5efacb7f17 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractInheritanceTests.cs @@ -0,0 +1,337 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +public sealed class OnlyAbstractInheritanceTests : ResourceInheritanceTests +{ + public OnlyAbstractInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.All)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.All)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("resourceInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, null)] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", null)] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, null)] + [InlineData("cyclePathIdentifierInResponse", false, null, null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs new file mode 100644 index 0000000000..3031856a70 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyAbstract/OnlyAbstractOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyAbstract; + +public sealed class OnlyAbstractOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return resourceType.ClrType.IsAbstract ? JsonApiEndpoints.All : JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs new file mode 100644 index 0000000000..d12808f9c7 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +internal sealed class OnlyConcreteEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return !resourceType.ClrType.IsAbstract; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs new file mode 100644 index 0000000000..6a0f9742df --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteInheritanceTests.cs @@ -0,0 +1,348 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +public sealed class OnlyConcreteInheritanceTests : ResourceInheritanceTests +{ + public OnlyConcreteInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.All)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.All)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.All)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.All)] + [InlineData(typeof(Mansion), JsonApiEndpoints.All)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.All)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.All)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.All)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.All)] + [InlineData(typeof(Toilet), JsonApiEndpoints.All)] + [InlineData(typeof(Road), JsonApiEndpoints.All)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.All)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", "bathrooms")] + [InlineData("bedroomResourceType", "bedrooms")] + [InlineData("kitchenResourceType", "kitchens")] + [InlineData("livingRoomResourceType", "livingRooms")] + [InlineData("toiletResourceType", "toilets")] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, "atomicOperation", "op|data")] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBedroomOperation", false, "atomicOperation", "op|data")] + [InlineData("createKitchenOperation", false, "atomicOperation", "op|data")] + [InlineData("createLivingRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createToiletOperation", false, "atomicOperation", "op|data")] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBedroomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateKitchenOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateLivingRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateToiletOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBedroomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteKitchenOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteLivingRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteToiletOperation", false, "atomicOperation", "op|ref")] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateToiletResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs new file mode 100644 index 0000000000..c29b005b5f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyConcrete/OnlyConcreteOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyConcrete; + +public sealed class OnlyConcreteOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return resourceType.ClrType.IsAbstract ? JsonApiEndpoints.None : JsonApiEndpoints.All; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs new file mode 100644 index 0000000000..2306a52b98 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return false; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs new file mode 100644 index 0000000000..94ada069cc --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsInheritanceTests.cs @@ -0,0 +1,350 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsInheritanceTests : ResourceInheritanceTests +{ + public OnlyOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, false) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInUpdateRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("attributesInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts|staffMembers")] + [InlineData("relationshipsInCreateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("relationshipsInUpdateRequest", + "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|cyclePaths|roads|districts")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addBuilding|updateBuilding|removeBuilding|" + + "addResidence|updateResidence|removeResidence|addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addFamilyHome|updateFamilyHome|removeFamilyHome|addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addMansion|updateMansion|removeMansion|addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "addRoom|updateRoom|removeRoom|updateRoomResidence|" + + "addBathroom|updateBathroom|removeBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroom|removeBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchen|removeKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoom|removeLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToilet|removeToilet|updateToiletResidence|" + + "addDistrict|updateDistrict|removeDistrict|addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads|" + + "addRoad|updateRoad|removeRoad|" + + "addCyclePath|updateCyclePath|removeCyclePath|" + + "addStaffMember|updateStaffMember|removeStaffMember" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, "atomicOperation", "op|data")] + [InlineData("createResidenceOperation", false, "createBuildingOperation", null)] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateResidenceOperation", false, "updateBuildingOperation", null)] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteResidenceOperation", false, "deleteBuildingOperation", null)] + [InlineData("deleteFamilyHomeOperation", false, "deleteResidenceOperation", null)] + [InlineData("deleteMansionOperation", false, "deleteResidenceOperation", null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateBathroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateBedroomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateKitchenRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateLivingRoomRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInUpdateToiletRequest", false, "dataInUpdateRoomRequest", null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateBathroomRequest", false, "attributesInUpdateRoomRequest", "hasBath")] + [InlineData("attributesInUpdateBedroomRequest", false, "attributesInUpdateRoomRequest", "bedCount")] + [InlineData("attributesInUpdateKitchenRequest", false, "attributesInUpdateRoomRequest", "hasPantry")] + [InlineData("attributesInUpdateLivingRoomRequest", false, "attributesInUpdateRoomRequest", "hasDiningTable")] + [InlineData("attributesInUpdateToiletRequest", false, "attributesInUpdateRoomRequest", "hasSink")] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, "relationshipsInUpdateRequest", "residence")] + [InlineData("relationshipsInUpdateBathroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInUpdateToiletRequest", false, "relationshipsInUpdateRoomRequest", null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateBedroomOperation", false, "updateRoomOperation", null)] + [InlineData("updateKitchenOperation", false, "updateRoomOperation", null)] + [InlineData("updateLivingRoomOperation", false, "updateRoomOperation", null)] + [InlineData("updateToiletOperation", false, "updateRoomOperation", null)] + [InlineData("deleteRoomOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteBathroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteBedroomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteKitchenOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteLivingRoomOperation", false, "deleteRoomOperation", null)] + [InlineData("deleteToiletOperation", false, "deleteRoomOperation", null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateCyclePathRequest", false, "dataInCreateRoadRequest", null)] + [InlineData("dataInUpdateRoadRequest", false, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateCyclePathRequest", false, "dataInUpdateRoadRequest", null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, "attributesInCreateRequest", "lengthInMeters")] + [InlineData("attributesInCreateCyclePathRequest", false, "attributesInCreateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInUpdateRoadRequest", false, "attributesInUpdateRequest", "lengthInMeters")] + [InlineData("attributesInUpdateCyclePathRequest", false, "attributesInUpdateRoadRequest", "hasLaneForPedestrians")] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, "relationshipsInCreateRoadRequest", null)] + [InlineData("relationshipsInUpdateRoadRequest", false, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, "relationshipsInUpdateRoadRequest", null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, "atomicOperation", "op|data")] + [InlineData("createCyclePathOperation", false, "createRoadOperation", null)] + [InlineData("updateRoadOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateCyclePathOperation", false, "updateRoadOperation", null)] + [InlineData("deleteRoadOperation", false, "atomicOperation", "op|ref")] + [InlineData("deleteCyclePathOperation", false, "deleteRoadOperation", null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs new file mode 100644 index 0000000000..d919512f97 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyOperations/OnlyOperationsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyOperations; + +public sealed class OnlyOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.All; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..c9cdbea0b0 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/GeneratedSwagger/swagger.g.json @@ -0,0 +1,6194 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/bathrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship.", + "operationId": "getBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bathrooms" + ], + "summary": "Retrieves the related residence identity of an individual bathroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bathroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bathrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bathroom.", + "operationId": "patchBathroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bathroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bathroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/bedrooms/{id}/relationships/residence": { + "get": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship.", + "operationId": "getBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "bedrooms" + ], + "summary": "Retrieves the related residence identity of an individual bedroom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The bedroom does not exist." + } + } + }, + "patch": { + "tags": [ + "bedrooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual bedroom.", + "operationId": "patchBedroomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the bedroom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The bedroom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/relationships/buildings": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship.", + "operationId": "getDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found building identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/buildingIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related building identities of an individual district's buildings relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related building identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing buildings to the buildings relationship of an individual district.", + "operationId": "postDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add buildings to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to add to the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing buildings to the buildings relationship of an individual district.", + "operationId": "patchDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose buildings relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to assign to the buildings relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing buildings from the buildings relationship of an individual district.", + "operationId": "deleteDistrictBuildingsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove buildings from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the buildings to remove from the buildings relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The buildings were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/districts/{id}/relationships/roads": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship.", + "operationId": "getDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found road identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roadIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves the related road identities of an individual district's roads relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose related road identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The district does not exist." + } + } + }, + "post": { + "tags": [ + "districts" + ], + "summary": "Adds existing roads to the roads relationship of an individual district.", + "operationId": "postDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to add roads to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to add to the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "districts" + ], + "summary": "Assigns existing roads to the roads relationship of an individual district.", + "operationId": "patchDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district whose roads relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to assign to the roads relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "districts" + ], + "summary": "Removes existing roads from the roads relationship of an individual district.", + "operationId": "deleteDistrictRoadsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the district to remove roads from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "description": "The identities of the roads to remove from the roads relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The roads were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The district or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + }, + "post": { + "tags": [ + "familyHomes" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "postFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "familyHomes" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual familyHome.", + "operationId": "patchFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "familyHomes" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual familyHome.", + "operationId": "deleteFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/kitchens/{id}/relationships/residence": { + "get": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship.", + "operationId": "getKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "kitchens" + ], + "summary": "Retrieves the related residence identity of an individual kitchen's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The kitchen does not exist." + } + } + }, + "patch": { + "tags": [ + "kitchens" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual kitchen.", + "operationId": "patchKitchenResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the kitchen whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The kitchen or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/livingRooms/{id}/relationships/residence": { + "get": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship.", + "operationId": "getLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "livingRooms" + ], + "summary": "Retrieves the related residence identity of an individual livingRoom's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The livingRoom does not exist." + } + } + }, + "patch": { + "tags": [ + "livingRooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual livingRoom.", + "operationId": "patchLivingRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the livingRoom whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The livingRoom or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/relationships/rooms": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship.", + "operationId": "getMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related room identities of an individual mansion's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual mansion.", + "operationId": "postMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual mansion.", + "operationId": "patchMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual mansion.", + "operationId": "deleteMansionRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/mansions/{id}/relationships/staff": { + "get": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship.", + "operationId": "getMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found staffMember identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/staffMemberIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "mansions" + ], + "summary": "Retrieves the related staffMember identities of an individual mansion's staff relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose related staffMember identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The mansion does not exist." + } + } + }, + "post": { + "tags": [ + "mansions" + ], + "summary": "Adds existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "postMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to add staffMembers to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to add to the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "mansions" + ], + "summary": "Assigns existing staffMembers to the staff relationship of an individual mansion.", + "operationId": "patchMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion whose staff relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to assign to the staff relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staff relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "mansions" + ], + "summary": "Removes existing staffMembers from the staff relationship of an individual mansion.", + "operationId": "deleteMansionStaffRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the mansion to remove staffMembers from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the staffMembers to remove from the staff relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The staffMembers were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The mansion or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/residences/{id}/relationships/rooms": { + "get": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship.", + "operationId": "getResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "residences" + ], + "summary": "Retrieves the related room identities of an individual residence's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The residence does not exist." + } + } + }, + "post": { + "tags": [ + "residences" + ], + "summary": "Adds existing rooms to the rooms relationship of an individual residence.", + "operationId": "postResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to add rooms to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to add to the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "residences" + ], + "summary": "Assigns existing rooms to the rooms relationship of an individual residence.", + "operationId": "patchResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence whose rooms relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to assign to the rooms relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "residences" + ], + "summary": "Removes existing rooms from the rooms relationship of an individual residence.", + "operationId": "deleteResidenceRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the residence to remove rooms from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the rooms to remove from the rooms relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The rooms were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The residence or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/rooms/{id}/relationships/residence": { + "get": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship.", + "operationId": "getRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "rooms" + ], + "summary": "Retrieves the related residence identity of an individual room's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The room does not exist." + } + } + }, + "patch": { + "tags": [ + "rooms" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual room.", + "operationId": "patchRoomResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the room whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The room or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/toilets/{id}/relationships/residence": { + "get": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship.", + "operationId": "getToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found residence identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/residenceIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "toilets" + ], + "summary": "Retrieves the related residence identity of an individual toilet's residence relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose related residence identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The toilet does not exist." + } + } + }, + "patch": { + "tags": [ + "toilets" + ], + "summary": "Assigns an existing residence to the residence relationship of an individual toilet.", + "operationId": "patchToiletResidenceRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the toilet whose residence relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the residence to assign to the residence relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The residence relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The toilet or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/addToResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/addToResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "addToResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addToDistrictBuildings": "#/components/schemas/addToDistrictBuildingsRelationshipOperation", + "addToDistrictRoads": "#/components/schemas/addToDistrictRoadsRelationshipOperation", + "addToFamilyHomeRooms": "#/components/schemas/addToFamilyHomeRoomsRelationshipOperation", + "addToMansionRooms": "#/components/schemas/addToMansionRoomsRelationshipOperation", + "addToMansionStaff": "#/components/schemas/addToMansionStaffRelationshipOperation", + "addToResidenceRooms": "#/components/schemas/addToResidenceRoomsRelationshipOperation", + "removeFromDistrictBuildings": "#/components/schemas/removeFromDistrictBuildingsRelationshipOperation", + "removeFromDistrictRoads": "#/components/schemas/removeFromDistrictRoadsRelationshipOperation", + "removeFromFamilyHomeRooms": "#/components/schemas/removeFromFamilyHomeRoomsRelationshipOperation", + "removeFromMansionRooms": "#/components/schemas/removeFromMansionRoomsRelationshipOperation", + "removeFromMansionStaff": "#/components/schemas/removeFromMansionStaffRelationshipOperation", + "removeFromResidenceRooms": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation", + "updateBathroomResidence": "#/components/schemas/updateBathroomResidenceRelationshipOperation", + "updateBedroomResidence": "#/components/schemas/updateBedroomResidenceRelationshipOperation", + "updateDistrictBuildings": "#/components/schemas/updateDistrictBuildingsRelationshipOperation", + "updateDistrictRoads": "#/components/schemas/updateDistrictRoadsRelationshipOperation", + "updateFamilyHomeRooms": "#/components/schemas/updateFamilyHomeRoomsRelationshipOperation", + "updateKitchenResidence": "#/components/schemas/updateKitchenResidenceRelationshipOperation", + "updateLivingRoomResidence": "#/components/schemas/updateLivingRoomResidenceRelationshipOperation", + "updateMansionRooms": "#/components/schemas/updateMansionRoomsRelationshipOperation", + "updateMansionStaff": "#/components/schemas/updateMansionStaffRelationshipOperation", + "updateResidenceRooms": "#/components/schemas/updateResidenceRoomsRelationshipOperation", + "updateRoomResidence": "#/components/schemas/updateRoomResidenceRelationshipOperation", + "updateToiletResidence": "#/components/schemas/updateToiletResidenceRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "cyclePathIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtBuildingsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/districtResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "districtBuildingsRelationshipName": { + "enum": [ + "buildings" + ], + "type": "string" + }, + "districtResourceType": { + "enum": [ + "districts" + ], + "type": "string" + }, + "districtRoadsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/districtResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "districtRoadsRelationshipName": { + "enum": [ + "roads" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "cyclePaths": "#/components/schemas/cyclePathIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "roads": "#/components/schemas/roadIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionResourceType": { + "enum": [ + "mansions" + ], + "type": "string" + }, + "mansionStaffRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionStaffRelationshipName": { + "enum": [ + "staff" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "removeFromDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/removeFromResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "residenceIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "residenceResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "residenceRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "residenceRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type" + }, + "x-abstract": true + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roadIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResidenceRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "roomResidenceRelationshipName": { + "enum": [ + "residence" + ], + "type": "string" + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBedroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateDistrictBuildingsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtBuildingsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateDistrictRoadsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/districtRoadsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateKitchenResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateLivingRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceRoomsRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateResidenceRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateToiletResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs new file mode 100644 index 0000000000..2425c64fb3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsEndpointFilter.cs @@ -0,0 +1,18 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return endpoint switch + { + JsonApiEndpoints.GetRelationship or JsonApiEndpoints.PostRelationship or JsonApiEndpoints.PatchRelationship or + JsonApiEndpoints.DeleteRelationship => true, + _ => false + }; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs new file mode 100644 index 0000000000..8d41ebaf68 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsInheritanceTests.cs @@ -0,0 +1,342 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsInheritanceTests : ResourceInheritanceTests +{ + private const JsonApiEndpoints OnlyRelationshipEndpoints = JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship | + JsonApiEndpoints.PatchRelationship | JsonApiEndpoints.DeleteRelationship; + + public OnlyRelationshipsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), OnlyRelationshipEndpoints)] + [InlineData(typeof(StaffMember), OnlyRelationshipEndpoints)] + [InlineData(typeof(Building), OnlyRelationshipEndpoints)] + [InlineData(typeof(Residence), OnlyRelationshipEndpoints)] + [InlineData(typeof(FamilyHome), OnlyRelationshipEndpoints)] + [InlineData(typeof(Mansion), OnlyRelationshipEndpoints)] + [InlineData(typeof(Room), OnlyRelationshipEndpoints)] + [InlineData(typeof(Kitchen), OnlyRelationshipEndpoints)] + [InlineData(typeof(Bedroom), OnlyRelationshipEndpoints)] + [InlineData(typeof(Bathroom), OnlyRelationshipEndpoints)] + [InlineData(typeof(LivingRoom), OnlyRelationshipEndpoints)] + [InlineData(typeof(Toilet), OnlyRelationshipEndpoints)] + [InlineData(typeof(Road), OnlyRelationshipEndpoints)] + [InlineData(typeof(CyclePath), OnlyRelationshipEndpoints)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, null)] + [InlineData("resourceInUpdateRequest", false, null)] + [InlineData("identifierInRequest", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + [InlineData("resourceInResponse", false, "")] + [InlineData("dataInBuildingResponse", true, null)] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, null)] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, null)] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", null)] + [InlineData("attributesInUpdateRequest", null)] + [InlineData("relationshipsInCreateRequest", null)] + [InlineData("relationshipsInUpdateRequest", null)] + [InlineData("!attributesInBuildingResponse", null)] + [InlineData("!relationshipsInBuildingResponse", null)] + [InlineData("!attributesInRoomResponse", null)] + [InlineData("!relationshipsInRoomResponse", null)] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "addToResidenceRooms|updateResidenceRooms|removeFromResidenceRooms|" + + "addToFamilyHomeRooms|updateFamilyHomeRooms|removeFromFamilyHomeRooms|" + + "addToMansionRooms|updateMansionRooms|removeFromMansionRooms|addToMansionStaff|updateMansionStaff|removeFromMansionStaff|" + + "updateRoomResidence|" + + "updateBathroomResidence|" + + "updateBedroomResidence|" + + "updateKitchenResidence|" + + "updateLivingRoomResidence|" + + "updateToiletResidence|" + + "addToDistrictBuildings|updateDistrictBuildings|removeFromDistrictBuildings|addToDistrictRoads|updateDistrictRoads|removeFromDistrictRoads" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", "familyHomes|mansions|residences")] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", "districts")] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, null)] + [InlineData("attributesInCreateRequest", true, null, null)] + [InlineData("relationshipsInCreateRequest", true, null, null)] + [InlineData("resourceInUpdateRequest", true, null, null)] + [InlineData("attributesInUpdateRequest", true, null, null)] + [InlineData("relationshipsInUpdateRequest", true, null, null)] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, null, null)] + [InlineData("dataInCreateResidenceRequest", false, null, null)] + [InlineData("dataInCreateFamilyHomeRequest", false, null, null)] + [InlineData("dataInCreateMansionRequest", false, null, null)] + [InlineData("dataInUpdateBuildingRequest", true, null, null)] + [InlineData("dataInUpdateResidenceRequest", false, null, null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("dataInUpdateMansionRequest", false, null, null)] + [InlineData("dataInBuildingResponse", true, null, null)] + [InlineData("dataInResidenceResponse", false, null, null)] + [InlineData("dataInFamilyHomeResponse", false, null, null)] + [InlineData("dataInMansionResponse", false, null, null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, null, null)] + [InlineData("attributesInCreateResidenceRequest", false, null, null)] + [InlineData("attributesInCreateFamilyHomeRequest", false, null, null)] + [InlineData("attributesInCreateMansionRequest", false, null, null)] + [InlineData("attributesInUpdateBuildingRequest", true, null, null)] + [InlineData("attributesInUpdateResidenceRequest", false, null, null)] + [InlineData("attributesInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("attributesInUpdateMansionRequest", false, null, null)] + [InlineData("attributesInBuildingResponse", true, null, null)] + [InlineData("attributesInResidenceResponse", false, null, null)] + [InlineData("attributesInFamilyHomeResponse", false, null, null)] + [InlineData("attributesInMansionResponse", false, null, null)] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, null, null)] + [InlineData("relationshipsInCreateResidenceRequest", false, null, null)] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, null, null)] + [InlineData("relationshipsInCreateMansionRequest", false, null, null)] + [InlineData("relationshipsInUpdateBuildingRequest", true, null, null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, null, null)] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, null, null)] + [InlineData("relationshipsInUpdateMansionRequest", false, null, null)] + [InlineData("relationshipsInBuildingResponse", true, null, null)] + [InlineData("relationshipsInResidenceResponse", false, null, null)] + [InlineData("relationshipsInFamilyHomeResponse", false, null, null)] + [InlineData("relationshipsInMansionResponse", false, null, null)] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, "updateResidenceRoomsRelationshipOperation", null)] + [InlineData("updateMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, "addToResidenceRoomsRelationshipOperation", null)] + [InlineData("addToMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "removeFromResidenceRoomsRelationshipOperation", null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, null, null)] + [InlineData("dataInCreateBathroomRequest", false, null, null)] + [InlineData("dataInCreateBedroomRequest", false, null, null)] + [InlineData("dataInCreateKitchenRequest", false, null, null)] + [InlineData("dataInCreateLivingRoomRequest", false, null, null)] + [InlineData("dataInCreateToiletRequest", false, null, null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, null, null)] + [InlineData("dataInBathroomResponse", false, null, null)] + [InlineData("dataInBedroomResponse", false, null, null)] + [InlineData("dataInKitchenResponse", false, null, null)] + [InlineData("dataInLivingRoomResponse", false, null, null)] + [InlineData("dataInToiletResponse", false, null, null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, null, null)] + [InlineData("attributesInCreateBathroomRequest", false, null, null)] + [InlineData("attributesInCreateBedroomRequest", false, null, null)] + [InlineData("attributesInCreateKitchenRequest", false, null, null)] + [InlineData("attributesInCreateLivingRoomRequest", false, null, null)] + [InlineData("attributesInCreateToiletRequest", false, null, null)] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, null, null)] + [InlineData("attributesInBathroomResponse", false, null, null)] + [InlineData("attributesInBedroomResponse", false, null, null)] + [InlineData("attributesInKitchenResponse", false, null, null)] + [InlineData("attributesInLivingRoomResponse", false, null, null)] + [InlineData("attributesInToiletResponse", false, null, null)] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, null, null)] + [InlineData("relationshipsInCreateBathroomRequest", false, null, null)] + [InlineData("relationshipsInCreateBedroomRequest", false, null, null)] + [InlineData("relationshipsInCreateKitchenRequest", false, null, null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInCreateToiletRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, null, null)] + [InlineData("relationshipsInBathroomResponse", false, null, null)] + [InlineData("relationshipsInBedroomResponse", false, null, null)] + [InlineData("relationshipsInKitchenResponse", false, null, null)] + [InlineData("relationshipsInLivingRoomResponse", false, null, null)] + [InlineData("relationshipsInToiletResponse", false, null, null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("cyclePathIdentifierInRequest", false, "roadIdentifierInRequest", null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs new file mode 100644 index 0000000000..528990caa3 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OnlyRelationships/OnlyRelationshipsOperationFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; + +namespace OpenApiTests.ResourceInheritance.OnlyRelationships; + +public sealed class OnlyRelationshipsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + return JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship | JsonApiEndpoints.PatchRelationship | JsonApiEndpoints.DeleteRelationship; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/OperationsController.cs b/test/OpenApiTests/ResourceInheritance/OperationsController.cs new file mode 100644 index 0000000000..ba56ca89b2 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/OperationsController.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using JsonApiDotNetCore.Resources; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.ResourceInheritance; + +public sealed class OperationsController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IOperationsProcessor processor, IJsonApiRequest request, + ITargetedFields targetedFields, IAtomicOperationFilter operationFilter) + : JsonApiOperationsController(options, resourceGraph, loggerFactory, processor, request, targetedFields, operationFilter); diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs new file mode 100644 index 0000000000..8856301cb9 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceControllerExtensions.cs @@ -0,0 +1,35 @@ +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceInheritance; + +public static class ResourceInheritanceControllerExtensions +{ + public static void UseInheritanceControllers( + this IntegrationTestContext, ResourceInheritanceDbContext> testContext, bool hasOperationsController) + { + ArgumentNullException.ThrowIfNull(testContext); + + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.UseController(); + testContext.UseController(); + + if (hasOperationsController) + { + testContext.UseController(); + } + } +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs new file mode 100644 index 0000000000..182282bf87 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceDbContext.cs @@ -0,0 +1,29 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using OpenApiTests.ResourceInheritance.Models; +using TestBuildingBlocks; + +namespace OpenApiTests.ResourceInheritance; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ResourceInheritanceDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet Districts => Set(); + public DbSet StaffMembers => Set(); + + public DbSet Buildings => Set(); + public DbSet Residences => Set(); + public DbSet FamilyHomes => Set(); + public DbSet Mansions => Set(); + + public DbSet Rooms => Set(); + public DbSet Kitchens => Set(); + public DbSet Bedrooms => Set(); + public DbSet Bathrooms => Set(); + public DbSet LivingRooms => Set(); + public DbSet Toilets => Set(); + + public DbSet Roads => Set(); + public DbSet CyclePaths => Set(); +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs new file mode 100644 index 0000000000..2e45c2bf0e --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceFakers.cs @@ -0,0 +1,85 @@ +using Bogus; +using JetBrains.Annotations; +using OpenApiTests.ResourceInheritance.Models; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.ResourceInheritance; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class ResourceInheritanceFakers +{ + private readonly Lazy> _lazyDistrictFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(district => district.Name, faker => faker.Address.County())); + + private readonly Lazy> _lazyStaffMemberFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(staffMember => staffMember.Name, faker => faker.Person.FullName)); + + private readonly Lazy> _lazyResidenceFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(residence => residence.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(residence => residence.NumberOfResidents, faker => faker.Random.Int(0, 15))); + + private readonly Lazy> _lazyMansionFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(mansion => mansion.SurfaceInSquareMeters, faker => faker.Random.Int(500, 2500)) + .RuleFor(mansion => mansion.NumberOfResidents, faker => faker.Random.Int(0, 150)) + .RuleFor(mansion => mansion.OwnerName, faker => faker.Person.FullName)); + + private readonly Lazy> _lazyFamilyHomeFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(familyHome => familyHome.SurfaceInSquareMeters, faker => faker.Random.Int(500, 2500)) + .RuleFor(familyHome => familyHome.NumberOfResidents, faker => faker.Random.Int(0, 150)) + .RuleFor(familyHome => familyHome.FloorCount, faker => faker.Random.Int(1, 4))); + + private readonly Lazy> _lazyKitchenFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(kitchen => kitchen.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(kitchen => kitchen.HasPantry, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyBedroomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(bedroom => bedroom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(bedroom => bedroom.BedCount, faker => faker.Random.Int(1, 5))); + + private readonly Lazy> _lazyBathroomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(bathroom => bathroom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(bathroom => bathroom.HasBath, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyLivingRoomFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(livingRoom => livingRoom.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(livingRoom => livingRoom.HasDiningTable, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyToiletFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(toilet => toilet.SurfaceInSquareMeters, faker => faker.Random.Int(50, 250)) + .RuleFor(toilet => toilet.HasSink, faker => faker.Random.Bool())); + + private readonly Lazy> _lazyRoadFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(road => road.LengthInMeters, faker => faker.Random.Int(20, 2500))); + + private readonly Lazy> _lazyCyclePathFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(cyclePath => cyclePath.LengthInMeters, faker => faker.Random.Int(20, 2500)) + .RuleFor(cyclePath => cyclePath.HasLaneForPedestrians, faker => faker.Random.Bool())); + + public Faker District => _lazyDistrictFaker.Value; + public Faker StaffMember => _lazyStaffMemberFaker.Value; + public Faker Residence => _lazyResidenceFaker.Value; + public Faker FamilyHome => _lazyFamilyHomeFaker.Value; + public Faker Mansion => _lazyMansionFaker.Value; + public Faker Kitchen => _lazyKitchenFaker.Value; + public Faker Bedroom => _lazyBedroomFaker.Value; + public Faker Bathroom => _lazyBathroomFaker.Value; + public Faker LivingRoom => _lazyLivingRoomFaker.Value; + public Faker Toilet => _lazyToiletFaker.Value; + public Faker Road => _lazyRoadFaker.Value; + public Faker CyclePath => _lazyCyclePathFaker.Value; +} diff --git a/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs new file mode 100644 index 0000000000..7455c0c899 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/ResourceInheritanceTests.cs @@ -0,0 +1,256 @@ +using System.Collections.ObjectModel; +using System.Text.Json; +using FluentAssertions; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable AV1755 // Name of async method should end with Async or TaskAsync + +namespace OpenApiTests.ResourceInheritance; + +public abstract class ResourceInheritanceTests : IClassFixture, ResourceInheritanceDbContext>> +{ + private readonly OpenApiTestContext, ResourceInheritanceDbContext> _testContext; + + protected ResourceInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper, bool hasOperationsController, bool writeToDisk) + { + _testContext = testContext; + + testContext.UseInheritanceControllers(hasOperationsController); + testContext.SetTestOutputHelper(testOutputHelper); + + if (writeToDisk) + { + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + } + + public virtual async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + // Arrange + var resourceGraph = _testContext.Factory.Services.GetRequiredService(); + ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); + IReadOnlyDictionary> endpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); + + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string[] pathsExpected = JsonPathBuilder.KnownEndpoints.Where(endpoint => expected.HasFlag(endpoint)) + .SelectMany(endpoint => endpointToPathMap[endpoint]).ToArray(); + + string[] pathsNotExpected = endpointToPathMap.Values.SelectMany(paths => paths).Except(pathsExpected).ToArray(); + + foreach (string path in pathsExpected) + { + document.Should().ContainPath(path); + } + + foreach (string path in pathsNotExpected) + { + document.Should().NotContainPath(path); + } + } + + public virtual async Task Operations_endpoint_is_exposed(bool enabled) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (enabled) + { + document.Should().ContainPath("paths./operations.post"); + } + else + { + document.Should().NotContainPath("paths./operations.post"); + } + } + + public virtual async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (discriminatorValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + string schemaPath = isWrapped ? $"components.schemas.{schemaName}.allOf[1]" : $"components.schemas.{schemaName}"; + + document.Should().ContainPath(schemaPath).With(schemaElement => + { + schemaElement.Should().ContainPath("discriminator").With(discriminatorElement => + { + discriminatorElement.Should().HaveProperty("propertyName", "type"); + + if (discriminatorValues.Length == 0) + { + discriminatorElement.Should().NotContainPath("mapping"); + } + else + { + discriminatorElement.Should().ContainPath("mapping").With(mappingElement => + { + string[] valueArray = discriminatorValues.Split('|'); + mappingElement.EnumerateObject().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + mappingElement.Should().ContainProperty(value); + } + }); + } + }); + }); + } + } + + public virtual async Task Expected_names_appear_in_openapi_discriminator_mapping(string prefixedSchemaName, string? discriminatorValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + string schemaName = prefixedSchemaName.StartsWith('!') ? prefixedSchemaName[1..] : prefixedSchemaName; + string discriminatorPath = prefixedSchemaName.StartsWith('!') ? "allOf[1].discriminator" : "discriminator"; + + // Assert + if (discriminatorValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + schemaElement.Should().ContainPath(discriminatorPath).With(discriminatorElement => + { + discriminatorElement.Should().HaveProperty("propertyName", "openapi:discriminator"); + + if (discriminatorValues.Length == 0) + { + discriminatorElement.Should().NotContainPath("mapping"); + } + else + { + discriminatorElement.Should().ContainPath("mapping").With(mappingElement => + { + string[] valueArray = discriminatorValues.Split('|'); + mappingElement.EnumerateObject().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + mappingElement.Should().ContainProperty(value); + } + }); + } + }); + }); + } + } + + public virtual async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (enumValues == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + if (enumValues.Length == 0) + { + schemaElement.Should().NotContainPath("enum"); + } + else + { + schemaElement.Should().ContainPath("enum").With(enumElement => + { + string[] valueArray = enumValues.Split('|'); + enumElement.EnumerateArray().Should().HaveCount(valueArray.Length); + + foreach (string value in valueArray) + { + enumElement.Should().ContainArrayElement(value); + } + }); + } + }); + } + } + + public virtual async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + if (baseType == null && properties == null) + { + document.Should().NotContainPath($"components.schemas.{schemaName}"); + } + else + { + document.Should().ContainPath($"components.schemas.{schemaName}").With(schemaElement => + { + if (baseType == null) + { + schemaElement.Should().NotContainPath("allOf[0]"); + } + else + { + schemaElement.Should().HaveProperty("allOf[0].$ref", $"#/components/schemas/{baseType}"); + } + + string propertiesPath = baseType != null ? "allOf[1].properties" : "properties"; + + if (properties == null) + { + schemaElement.Should().NotContainPath(propertiesPath); + } + else + { + string[] propertyArray = properties.Split('|'); + + schemaElement.Should().ContainPath(propertiesPath).With(propertiesElement => + { + propertiesElement.EnumerateObject().Should().HaveCount(propertyArray.Length); + + foreach (string value in propertyArray) + { + propertiesElement.Should().ContainProperty(value); + } + }); + } + + string abstractPath = baseType != null ? "allOf[1].x-abstract" : "x-abstract"; + + if (!isAbstract) + { + schemaElement.Should().NotContainPath(abstractPath); + } + else + { + schemaElement.Should().ContainPath(abstractPath).With(abstractElement => + { + abstractElement.Should().Be(true); + }); + } + }); + } + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..88e0ed9f8d --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3258 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/operations": { + "post": { + "tags": [ + "operations" + ], + "summary": "Performs multiple mutations in a linear and atomic manner.", + "operationId": "postOperations", + "requestBody": { + "description": "An array of mutation operations. For syntax, see the [Atomic Operations documentation](https://jsonapi.org/ext/atomic/).", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/operationsRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "All operations were successfully applied, which resulted in additional changes.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/operationsResponseDocument" + } + } + } + }, + "204": { + "description": "All operations were successfully applied, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "An operation is not accessible or a client-generated ID is used.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A resource or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=atomic; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "addOperationCode": { + "enum": [ + "add" + ], + "type": "string" + }, + "addToFamilyHomeRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "atomicOperation": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "type": "string" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "addBathroom": "#/components/schemas/createBathroomOperation", + "addBedroom": "#/components/schemas/createBedroomOperation", + "addFamilyHome": "#/components/schemas/createFamilyHomeOperation", + "addKitchen": "#/components/schemas/createKitchenOperation", + "addLivingRoom": "#/components/schemas/createLivingRoomOperation", + "addMansion": "#/components/schemas/createMansionOperation", + "addResidence": "#/components/schemas/createResidenceOperation", + "addRoom": "#/components/schemas/createRoomOperation", + "addToFamilyHomeRooms": "#/components/schemas/addToFamilyHomeRoomsRelationshipOperation", + "addToilet": "#/components/schemas/createToiletOperation", + "removeFromMansionRooms": "#/components/schemas/removeFromMansionRoomsRelationshipOperation", + "removeFromMansionStaff": "#/components/schemas/removeFromMansionStaffRelationshipOperation", + "updateBathroomResidence": "#/components/schemas/updateBathroomResidenceRelationshipOperation", + "updateBedroomResidence": "#/components/schemas/updateBedroomResidenceRelationshipOperation", + "updateFamilyHome": "#/components/schemas/updateFamilyHomeOperation", + "updateKitchenResidence": "#/components/schemas/updateKitchenResidenceRelationshipOperation", + "updateLivingRoomResidence": "#/components/schemas/updateLivingRoomResidenceRelationshipOperation", + "updateMansion": "#/components/schemas/updateMansionOperation", + "updateResidence": "#/components/schemas/updateResidenceOperation", + "updateRoomResidence": "#/components/schemas/updateRoomResidenceRelationshipOperation", + "updateToiletResidence": "#/components/schemas/updateToiletResidenceRelationshipOperation" + } + }, + "x-abstract": true + }, + "atomicResult": { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasBath" + ], + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "bedCount" + ], + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasPantry" + ], + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasDiningTable" + ], + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInCreateBathroomRequest", + "bedrooms": "#/components/schemas/attributesInCreateBedroomRequest", + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/attributesInCreateKitchenRequest", + "livingRooms": "#/components/schemas/attributesInCreateLivingRoomRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest", + "rooms": "#/components/schemas/attributesInCreateRoomRequest", + "toilets": "#/components/schemas/attributesInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + }, + { + "required": [ + "hasSink" + ], + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBathroomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createBedroomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createFamilyHomeOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createKitchenOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createLivingRoomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createMansionOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createResidenceOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createRoomOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/addOperationCode" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createToiletOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/createRoomOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBathroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBedroomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateKitchenRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateLivingRoomRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRoomRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateToiletRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "familyHomeResourceType": { + "enum": [ + "familyHomes" + ], + "type": "string" + }, + "familyHomeRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/familyHomeRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "familyHomeRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "buildings": "#/components/schemas/buildingIdentifierInRequest", + "familyHomes": "#/components/schemas/familyHomeIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "mansions": "#/components/schemas/mansionIdentifierInRequest", + "residences": "#/components/schemas/residenceIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionResourceType": { + "enum": [ + "mansions" + ], + "type": "string" + }, + "mansionRoomsRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionRoomsRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionRoomsRelationshipName": { + "enum": [ + "rooms" + ], + "type": "string" + }, + "mansionStaffRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "mansionStaffRelationshipName": { + "enum": [ + "staff" + ], + "type": "string" + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "operationsRequestDocument": { + "required": [ + "atomic:operations" + ], + "type": "object", + "properties": { + "atomic:operations": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicOperation" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "operationsResponseDocument": { + "required": [ + "atomic:results", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "atomic:results": { + "minItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/atomicResult" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBathroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBedroomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateKitchenRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateLivingRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInCreateBathroomRequest", + "bedrooms": "#/components/schemas/relationshipsInCreateBedroomRequest", + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/relationshipsInCreateKitchenRequest", + "livingRooms": "#/components/schemas/relationshipsInCreateLivingRoomRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest", + "rooms": "#/components/schemas/relationshipsInCreateRoomRequest", + "toilets": "#/components/schemas/relationshipsInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRoomRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "residence" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateToiletRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRoomRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionRoomsRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionRoomsRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeFromMansionStaffRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/removeOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/mansionStaffRelationshipIdentifier" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "removeOperationCode": { + "enum": [ + "remove" + ], + "type": "string" + }, + "residenceIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInCreateBathroomRequest", + "bedrooms": "#/components/schemas/dataInCreateBedroomRequest", + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "kitchens": "#/components/schemas/dataInCreateKitchenRequest", + "livingRooms": "#/components/schemas/dataInCreateLivingRoomRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest", + "rooms": "#/components/schemas/dataInCreateRoomRequest", + "toilets": "#/components/schemas/dataInCreateToiletRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResidenceRelationshipIdentifier": { + "required": [ + "relationship", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + }, + "relationship": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipName" + } + ] + } + }, + "additionalProperties": false + }, + "roomResidenceRelationshipName": { + "enum": [ + "residence" + ], + "type": "string" + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "lid": { + "minLength": 1, + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBathroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBedroomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateFamilyHomeOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateKitchenResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateLivingRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateMansionOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateResidenceOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateOperationCode": { + "enum": [ + "update" + ], + "type": "string" + }, + "updateResidenceOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateRoomResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/atomicOperation" + }, + { + "required": [ + "data", + "op", + "ref" + ], + "type": "object", + "properties": { + "op": { + "allOf": [ + { + "$ref": "#/components/schemas/updateOperationCode" + } + ] + }, + "ref": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResidenceRelationshipIdentifier" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateToiletResidenceRelationshipOperation": { + "allOf": [ + { + "$ref": "#/components/schemas/updateRoomResidenceRelationshipOperation" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs new file mode 100644 index 0000000000..ebeb7e0018 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsEndpointFilter.cs @@ -0,0 +1,13 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return false; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs new file mode 100644 index 0000000000..7d49d6b2ea --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsInheritanceTests.cs @@ -0,0 +1,341 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +#pragma warning disable format + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsInheritanceTests : ResourceInheritanceTests +{ + public SubsetOfOperationsInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, true, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.None)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.None)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.None)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.None)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(true)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + [InlineData("resourceInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, null)] + [InlineData("roadIdentifierInResponse", false, null)] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings|bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", null)] + [InlineData("!relationshipsInRoadResponse", null)] + [InlineData("atomicOperation", + // @formatter:keep_existing_linebreaks true + "" + + "addResidence|updateResidence|" + + "addFamilyHome|updateFamilyHome|addToFamilyHomeRooms|" + + "addMansion|updateMansion|removeFromMansionRooms|removeFromMansionStaff|" + + "addRoom|updateRoomResidence|" + + "addBathroom|updateBathroomResidence|" + + "addBedroom|updateBedroomResidence|" + + "addKitchen|updateKitchenResidence|" + + "addLivingRoom|updateLivingRoomResidence|" + + "addToilet|updateToiletResidence" + + "" + + "" + + "" + + "" + // @formatter:keep_existing_linebreaks restore + )] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", "familyHomes")] + [InlineData("mansionResourceType", "mansions")] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", null)] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, "openapi:discriminator|meta")] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|lid|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("residenceIdentifierInRequest", false, "buildingIdentifierInRequest", null)] + [InlineData("familyHomeIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("mansionIdentifierInRequest", false, "residenceIdentifierInRequest", null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, "atomicOperation", "op|data")] + [InlineData("createFamilyHomeOperation", false, "createResidenceOperation", null)] + [InlineData("createMansionOperation", false, "createResidenceOperation", null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateFamilyHomeOperation", false, "updateResidenceOperation", null)] + [InlineData("updateMansionOperation", false, "updateResidenceOperation", null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("removeFromMansionStaffRelationshipOperation", false, "atomicOperation", "op|ref|data")] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, "resourceInCreateRequest", "lid|attributes|relationships")] + [InlineData("dataInCreateBathroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateBedroomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateKitchenRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateLivingRoomRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInCreateToiletRequest", false, "dataInCreateRoomRequest", null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateBathroomRequest", false, "attributesInCreateRoomRequest", "hasBath")] + [InlineData("attributesInCreateBedroomRequest", false, "attributesInCreateRoomRequest", "bedCount")] + [InlineData("attributesInCreateKitchenRequest", false, "attributesInCreateRoomRequest", "hasPantry")] + [InlineData("attributesInCreateLivingRoomRequest", false, "attributesInCreateRoomRequest", "hasDiningTable")] + [InlineData("attributesInCreateToiletRequest", false, "attributesInCreateRoomRequest", "hasSink")] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, "relationshipsInCreateRequest", "residence")] + [InlineData("relationshipsInCreateBathroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateBedroomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateKitchenRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInCreateToiletRequest", false, "relationshipsInCreateRoomRequest", null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id|lid")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, "atomicOperation", "op|data")] + [InlineData("createBathroomOperation", false, "createRoomOperation", null)] + [InlineData("createBedroomOperation", false, "createRoomOperation", null)] + [InlineData("createKitchenOperation", false, "createRoomOperation", null)] + [InlineData("createLivingRoomOperation", false, "createRoomOperation", null)] + [InlineData("createToiletOperation", false, "createRoomOperation", null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, "atomicOperation", "op|ref|data")] + [InlineData("updateBathroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, "updateRoomResidenceRelationshipOperation", null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, null, null)] + [InlineData("dataInCyclePathResponse", false, null, null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, null, null)] + [InlineData("attributesInCyclePathResponse", false, null, null)] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, null, null)] + [InlineData("relationshipsInCyclePathResponse", false, null, null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, null)] + [InlineData("cyclePathIdentifierInResponse", false, null, null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs new file mode 100644 index 0000000000..0636b46e47 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfOperations/SubsetOfOperationsOperationFilter.cs @@ -0,0 +1,36 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfOperations; + +public sealed class SubsetOfOperationsOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + Type resourceClrType = resourceType.ClrType; + + if (resourceClrType == typeof(Residence)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.Patch; + } + + if (resourceClrType == typeof(FamilyHome)) + { + return JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship; + } + + if (resourceClrType == typeof(Mansion)) + { + return JsonApiEndpoints.DeleteRelationship; + } + + if (resourceClrType == typeof(Room)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.PatchRelationship; + } + + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..42301a5d4d --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/GeneratedSwagger/swagger.g.json @@ -0,0 +1,3369 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/buildings": { + "post": { + "tags": [ + "buildings" + ], + "summary": "Creates a new building.", + "operationId": "postBuilding", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The building was successfully created, which resulted in additional changes. The newly created building is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created building can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/buildings/{id}": { + "patch": { + "tags": [ + "buildings" + ], + "summary": "Updates an existing building.", + "operationId": "patchBuilding", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the building to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the building to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateBuildingRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The building was successfully updated, which resulted in additional changes. The updated building is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryBuildingResponseDocument" + } + } + } + }, + "204": { + "description": "The building was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The building or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/cyclePaths/{id}": { + "get": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier.", + "operationId": "getCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found cyclePath.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryCyclePathResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The cyclePath does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "cyclePaths" + ], + "summary": "Retrieves an individual cyclePath by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headCyclePath", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the cyclePath to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The cyclePath does not exist." + } + } + } + }, + "/districts": { + "get": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts.", + "operationId": "getDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found districts, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/districtCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "districts" + ], + "summary": "Retrieves a collection of districts without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDistrictCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + } + }, + "/familyHomes/{id}/relationships/rooms": { + "get": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship.", + "operationId": "getFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found room identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/roomIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The familyHome does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "familyHomes" + ], + "summary": "Retrieves the related room identities of an individual familyHome's rooms relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headFamilyHomeRoomsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the familyHome whose related room identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The familyHome does not exist." + } + } + } + } + }, + "components": { + "schemas": { + "attributesInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasBath": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "bedCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "required": [ + "surfaceInSquareMeters" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateResidenceRequest" + }, + { + "required": [ + "ownerName" + ], + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInCreateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInCreateMansionRequest", + "residences": "#/components/schemas/attributesInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + }, + { + "required": [ + "numberOfResidents" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + }, + { + "type": "object", + "properties": { + "hasLaneForPedestrians": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasPantry": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasDiningTable": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResidenceResponse" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "mansions": "#/components/schemas/attributesInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "buildings": "#/components/schemas/attributesInBuildingResponse", + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse", + "districts": "#/components/schemas/attributesInDistrictResponse", + "familyHomes": "#/components/schemas/attributesInFamilyHomeResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "mansions": "#/components/schemas/attributesInMansionResponse", + "residences": "#/components/schemas/attributesInResidenceResponse", + "roads": "#/components/schemas/attributesInRoadResponse", + "rooms": "#/components/schemas/attributesInRoomResponse", + "staffMembers": "#/components/schemas/attributesInStaffMemberResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + }, + "attributesInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "lengthInMeters": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/attributesInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "attributesInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/attributesInBathroomResponse", + "bedrooms": "#/components/schemas/attributesInBedroomResponse", + "kitchens": "#/components/schemas/attributesInKitchenResponse", + "livingRooms": "#/components/schemas/attributesInLivingRoomResponse", + "toilets": "#/components/schemas/attributesInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + }, + { + "type": "object", + "properties": { + "hasSink": { + "type": "boolean" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "surfaceInSquareMeters": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "attributesInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "floorCount": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "ownerName": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/attributesInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/attributesInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/attributesInUpdateMansionRequest", + "residences": "#/components/schemas/attributesInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "numberOfResidents": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bathroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "bedroomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "buildingIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse", + "residences": "#/components/schemas/residenceIdentifierInResponse" + } + }, + "x-abstract": true + }, + "buildingResourceType": { + "enum": [ + "familyHomes", + "mansions", + "residences" + ], + "type": "string" + }, + "createBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "cyclePathIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roadIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInBuildingResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInCreateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCreateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "uuid" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDistrictResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInDistrictResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "mansions": "#/components/schemas/dataInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoadResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/dataInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "dataInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInRoomResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInStaffMemberResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInStaffMemberResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateBuildingRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + } + ] + } + }, + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "dataInUpdateFamilyHomeRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateMansionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateResidenceRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "districtCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInDistrictResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "familyHomeIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInRequest", + "bedrooms": "#/components/schemas/bedroomIdentifierInRequest", + "kitchens": "#/components/schemas/kitchenIdentifierInRequest", + "livingRooms": "#/components/schemas/livingRoomIdentifierInRequest", + "rooms": "#/components/schemas/roomIdentifierInRequest", + "staffMembers": "#/components/schemas/staffMemberIdentifierInRequest", + "toilets": "#/components/schemas/toiletIdentifierInRequest" + } + }, + "x-abstract": true + }, + "kitchenIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "kitchenIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "livingRoomIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "mansionIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "primaryBuildingResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInBuildingResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryCyclePathResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCyclePathResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInBathroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBedroomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInBuildingResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInCreateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInCreateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInCreateMansionRequest", + "residences": "#/components/schemas/relationshipsInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInCyclePathResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoadResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInDistrictResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "buildings": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyBuildingInResponse" + } + ] + }, + "roads": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoadInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInFamilyHomeResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInKitchenResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInLivingRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInMansionResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResidenceResponse" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResidenceResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInBuildingResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "buildings": "#/components/schemas/relationshipsInBuildingResponse", + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse", + "districts": "#/components/schemas/relationshipsInDistrictResponse", + "familyHomes": "#/components/schemas/relationshipsInFamilyHomeResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "mansions": "#/components/schemas/relationshipsInMansionResponse", + "residences": "#/components/schemas/relationshipsInResidenceResponse", + "roads": "#/components/schemas/relationshipsInRoadResponse", + "rooms": "#/components/schemas/relationshipsInRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + }, + "relationshipsInRoadResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "cyclePaths": "#/components/schemas/relationshipsInCyclePathResponse" + } + } + } + ], + "additionalProperties": false + }, + "relationshipsInRoomResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "residence": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneResidenceInResponse" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "bathrooms": "#/components/schemas/relationshipsInBathroomResponse", + "bedrooms": "#/components/schemas/relationshipsInBedroomResponse", + "kitchens": "#/components/schemas/relationshipsInKitchenResponse", + "livingRooms": "#/components/schemas/relationshipsInLivingRoomResponse", + "toilets": "#/components/schemas/relationshipsInToiletResponse" + } + }, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInToiletResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInRoomResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateBuildingRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "additionalProperties": false, + "x-abstract": true + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateFamilyHomeRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateMansionRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateResidenceRequest" + }, + { + "type": "object", + "properties": { + "staff": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyStaffMemberInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "buildings": "#/components/schemas/relationshipsInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/relationshipsInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/relationshipsInUpdateMansionRequest", + "residences": "#/components/schemas/relationshipsInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateResidenceRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateBuildingRequest" + }, + { + "type": "object", + "properties": { + "rooms": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyRoomInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "residenceIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + }, + { + "required": [ + "type" + ], + "type": "object", + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "familyHomes": "#/components/schemas/familyHomeIdentifierInResponse", + "mansions": "#/components/schemas/mansionIdentifierInResponse" + } + } + } + ], + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInCreateBuildingRequest", + "familyHomes": "#/components/schemas/dataInCreateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInCreateMansionRequest", + "residences": "#/components/schemas/dataInCreateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/dataInBathroomResponse", + "bedrooms": "#/components/schemas/dataInBedroomResponse", + "buildings": "#/components/schemas/dataInBuildingResponse", + "cyclePaths": "#/components/schemas/dataInCyclePathResponse", + "districts": "#/components/schemas/dataInDistrictResponse", + "familyHomes": "#/components/schemas/dataInFamilyHomeResponse", + "kitchens": "#/components/schemas/dataInKitchenResponse", + "livingRooms": "#/components/schemas/dataInLivingRoomResponse", + "mansions": "#/components/schemas/dataInMansionResponse", + "residences": "#/components/schemas/dataInResidenceResponse", + "roads": "#/components/schemas/dataInRoadResponse", + "rooms": "#/components/schemas/dataInRoomResponse", + "staffMembers": "#/components/schemas/dataInStaffMemberResponse", + "toilets": "#/components/schemas/dataInToiletResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "buildings": "#/components/schemas/dataInUpdateBuildingRequest", + "familyHomes": "#/components/schemas/dataInUpdateFamilyHomeRequest", + "mansions": "#/components/schemas/dataInUpdateMansionRequest", + "residences": "#/components/schemas/dataInUpdateResidenceRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "buildings", + "cyclePaths", + "districts", + "familyHomes", + "kitchens", + "livingRooms", + "mansions", + "residences", + "roads", + "rooms", + "staffMembers", + "toilets" + ], + "type": "string" + }, + "roadIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roadResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "cyclePaths": "#/components/schemas/cyclePathIdentifierInResponse" + } + } + }, + "roadResourceType": { + "enum": [ + "cyclePaths", + "roads" + ], + "type": "string" + }, + "roomIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "roomIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "roomIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/roomResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "bathrooms": "#/components/schemas/bathroomIdentifierInResponse", + "bedrooms": "#/components/schemas/bedroomIdentifierInResponse", + "kitchens": "#/components/schemas/kitchenIdentifierInResponse", + "livingRooms": "#/components/schemas/livingRoomIdentifierInResponse", + "toilets": "#/components/schemas/toiletIdentifierInResponse" + } + }, + "x-abstract": true + }, + "roomResourceType": { + "enum": [ + "bathrooms", + "bedrooms", + "kitchens", + "livingRooms", + "toilets" + ], + "type": "string" + }, + "staffMemberIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "staffMemberIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/staffMemberResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "staffMemberResourceType": { + "enum": [ + "staffMembers" + ], + "type": "string" + }, + "toManyBuildingInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/buildingIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoadInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roadIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyRoomInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/roomIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyStaffMemberInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/staffMemberIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneResidenceInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/residenceIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toiletIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInRequest" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "toiletIdentifierInResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/roomIdentifierInResponse" + }, + { + "type": "object", + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "updateBuildingRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateBuildingRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs new file mode 100644 index 0000000000..1675f08197 --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousEndpointFilter.cs @@ -0,0 +1,21 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousEndpointFilter : IJsonApiEndpointFilter +{ + public bool IsEnabled(ResourceType resourceType, JsonApiEndpoints endpoint) + { + return resourceType.ClrType.Name switch + { + nameof(District) => endpoint == JsonApiEndpoints.GetCollection, + nameof(Building) => endpoint is JsonApiEndpoints.Post or JsonApiEndpoints.Patch, + nameof(FamilyHome) => endpoint is JsonApiEndpoints.GetRelationship, + nameof(CyclePath) => endpoint is JsonApiEndpoints.GetSingle, + _ => false + }; + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs new file mode 100644 index 0000000000..24de06c72a --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousInheritanceTests.cs @@ -0,0 +1,324 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Middleware; +using Microsoft.Extensions.DependencyInjection; +using OpenApiTests.ResourceInheritance.Models; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousInheritanceTests : ResourceInheritanceTests +{ + public SubsetOfVariousInheritanceTests(OpenApiTestContext, ResourceInheritanceDbContext> testContext, + ITestOutputHelper testOutputHelper) + : base(testContext, testOutputHelper, false, true) + { + testContext.ConfigureServices(services => + { + services.AddSingleton(); + services.AddSingleton(); + }); + } + + [Theory] + [InlineData(typeof(District), JsonApiEndpoints.GetCollection)] + [InlineData(typeof(StaffMember), JsonApiEndpoints.None)] + [InlineData(typeof(Building), JsonApiEndpoints.Post | JsonApiEndpoints.Patch)] + [InlineData(typeof(Residence), JsonApiEndpoints.None)] + [InlineData(typeof(FamilyHome), JsonApiEndpoints.GetRelationship)] + [InlineData(typeof(Mansion), JsonApiEndpoints.None)] + [InlineData(typeof(Room), JsonApiEndpoints.None)] + [InlineData(typeof(Kitchen), JsonApiEndpoints.None)] + [InlineData(typeof(Bedroom), JsonApiEndpoints.None)] + [InlineData(typeof(Bathroom), JsonApiEndpoints.None)] + [InlineData(typeof(LivingRoom), JsonApiEndpoints.None)] + [InlineData(typeof(Toilet), JsonApiEndpoints.None)] + [InlineData(typeof(Road), JsonApiEndpoints.None)] + [InlineData(typeof(CyclePath), JsonApiEndpoints.GetSingle)] + public override async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + await base.Only_expected_endpoints_are_exposed(resourceClrType, expected); + } + + [Theory] + [InlineData(false)] + public override async Task Operations_endpoint_is_exposed(bool enabled) + { + await base.Operations_endpoint_is_exposed(enabled); + } + + [Theory] + [InlineData("resourceInCreateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("resourceInUpdateRequest", false, "familyHomes|mansions|residences|buildings")] + [InlineData("identifierInRequest", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|staffMembers")] + [InlineData("resourceInResponse", false, + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|districts|roads|cyclePaths|staffMembers")] + [InlineData("dataInBuildingResponse", true, "familyHomes|mansions|residences")] + [InlineData("buildingIdentifierInResponse", false, "familyHomes|mansions|residences")] + [InlineData("dataInResidenceResponse", true, "familyHomes|mansions")] + [InlineData("residenceIdentifierInResponse", true, "familyHomes|mansions")] + [InlineData("dataInRoomResponse", true, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("roomIdentifierInResponse", false, "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("dataInRoadResponse", true, "cyclePaths")] + [InlineData("roadIdentifierInResponse", false, "cyclePaths")] + public override async Task Expected_names_appear_in_type_discriminator_mapping(string schemaName, bool isWrapped, string? discriminatorValues) + { + await base.Expected_names_appear_in_type_discriminator_mapping(schemaName, isWrapped, discriminatorValues); + } + + [Theory] + [InlineData("attributesInCreateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("attributesInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInCreateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("relationshipsInUpdateRequest", "familyHomes|mansions|residences|buildings")] + [InlineData("!attributesInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!relationshipsInBuildingResponse", "familyHomes|mansions|residences")] + [InlineData("!attributesInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!relationshipsInRoomResponse", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("!attributesInRoadResponse", "cyclePaths")] + [InlineData("!relationshipsInRoadResponse", "cyclePaths")] + [InlineData("atomicOperation", null)] + public override async Task Expected_names_appear_in_openapi_discriminator_mapping(string schemaName, string? discriminatorValues) + { + await base.Expected_names_appear_in_openapi_discriminator_mapping(schemaName, discriminatorValues); + } + + [Theory] + [InlineData("buildingResourceType", "familyHomes|mansions|residences")] + [InlineData("residenceResourceType", null)] + [InlineData("familyHomeResourceType", null)] + [InlineData("mansionResourceType", null)] + [InlineData("roomResourceType", "bathrooms|bedrooms|kitchens|livingRooms|toilets")] + [InlineData("bathroomResourceType", null)] + [InlineData("bedroomResourceType", null)] + [InlineData("kitchenResourceType", null)] + [InlineData("livingRoomResourceType", null)] + [InlineData("toiletResourceType", null)] + [InlineData("roadResourceType", "roads|cyclePaths")] + [InlineData("cyclePathResourceType", null)] + [InlineData("districtResourceType", null)] + [InlineData("staffMemberResourceType", "staffMembers")] + [InlineData("resourceType", + "bathrooms|bedrooms|kitchens|livingRooms|toilets|rooms|familyHomes|mansions|residences|buildings|roads|cyclePaths|districts|staffMembers")] + public override async Task Expected_names_appear_in_resource_type_enum(string schemaName, string? enumValues) + { + await base.Expected_names_appear_in_resource_type_enum(schemaName, enumValues); + } + + [Theory] + [InlineData("resourceInCreateRequest", true, null, "type|meta")] + [InlineData("attributesInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInCreateRequest", true, null, "openapi:discriminator")] + [InlineData("resourceInUpdateRequest", true, null, "type|meta")] + [InlineData("attributesInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("relationshipsInUpdateRequest", true, null, "openapi:discriminator")] + [InlineData("identifierInRequest", true, null, "type|meta")] + [InlineData("resourceInResponse", true, null, "type|meta")] + [InlineData("atomicOperation", true, null, null)] + // Building hierarchy: Resource Data + [InlineData("dataInCreateBuildingRequest", true, "resourceInCreateRequest", "attributes|relationships")] + [InlineData("dataInCreateResidenceRequest", false, "dataInCreateBuildingRequest", null)] + [InlineData("dataInCreateFamilyHomeRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInCreateMansionRequest", false, "dataInCreateResidenceRequest", null)] + [InlineData("dataInUpdateBuildingRequest", true, "resourceInUpdateRequest", "id|attributes|relationships")] + [InlineData("dataInUpdateResidenceRequest", false, "dataInUpdateBuildingRequest", null)] + [InlineData("dataInUpdateFamilyHomeRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInUpdateMansionRequest", false, "dataInUpdateResidenceRequest", null)] + [InlineData("dataInBuildingResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInResidenceResponse", false, "dataInBuildingResponse", null)] + [InlineData("dataInFamilyHomeResponse", false, "dataInResidenceResponse", null)] + [InlineData("dataInMansionResponse", false, "dataInResidenceResponse", null)] + // Building hierarchy: Attributes + [InlineData("attributesInCreateBuildingRequest", true, "attributesInCreateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInCreateResidenceRequest", false, "attributesInCreateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInCreateFamilyHomeRequest", false, "attributesInCreateResidenceRequest", "floorCount")] + [InlineData("attributesInCreateMansionRequest", false, "attributesInCreateResidenceRequest", "ownerName")] + [InlineData("attributesInUpdateBuildingRequest", true, "attributesInUpdateRequest", "surfaceInSquareMeters")] + [InlineData("attributesInUpdateResidenceRequest", false, "attributesInUpdateBuildingRequest", "numberOfResidents")] + [InlineData("attributesInUpdateFamilyHomeRequest", false, "attributesInUpdateResidenceRequest", "floorCount")] + [InlineData("attributesInUpdateMansionRequest", false, "attributesInUpdateResidenceRequest", "ownerName")] + [InlineData("attributesInBuildingResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInResidenceResponse", false, "attributesInBuildingResponse", "numberOfResidents")] + [InlineData("attributesInFamilyHomeResponse", false, "attributesInResidenceResponse", "floorCount")] + [InlineData("attributesInMansionResponse", false, "attributesInResidenceResponse", "ownerName")] + // Building hierarchy: Relationships + [InlineData("relationshipsInCreateBuildingRequest", true, "relationshipsInCreateRequest", null)] + [InlineData("relationshipsInCreateResidenceRequest", false, "relationshipsInCreateBuildingRequest", "rooms")] + [InlineData("relationshipsInCreateFamilyHomeRequest", false, "relationshipsInCreateResidenceRequest", null)] + [InlineData("relationshipsInCreateMansionRequest", false, "relationshipsInCreateResidenceRequest", "staff")] + [InlineData("relationshipsInUpdateBuildingRequest", true, "relationshipsInUpdateRequest", null)] + [InlineData("relationshipsInUpdateResidenceRequest", false, "relationshipsInUpdateBuildingRequest", "rooms")] + [InlineData("relationshipsInUpdateFamilyHomeRequest", false, "relationshipsInUpdateResidenceRequest", null)] + [InlineData("relationshipsInUpdateMansionRequest", false, "relationshipsInUpdateResidenceRequest", "staff")] + [InlineData("relationshipsInBuildingResponse", true, "relationshipsInResponse", null)] + [InlineData("relationshipsInResidenceResponse", false, "relationshipsInBuildingResponse", "rooms")] + [InlineData("relationshipsInFamilyHomeResponse", false, "relationshipsInResidenceResponse", null)] + [InlineData("relationshipsInMansionResponse", false, "relationshipsInResidenceResponse", "staff")] + // Building hierarchy: Resource Identifiers + [InlineData("buildingIdentifierInRequest", false, null, null)] + [InlineData("residenceIdentifierInRequest", false, null, null)] + [InlineData("familyHomeIdentifierInRequest", false, null, null)] + [InlineData("mansionIdentifierInRequest", false, null, null)] + [InlineData("buildingIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("residenceIdentifierInResponse", false, "buildingIdentifierInResponse", null)] + [InlineData("familyHomeIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + [InlineData("mansionIdentifierInResponse", false, "residenceIdentifierInResponse", null)] + // Building hierarchy: Atomic Operations + [InlineData("createBuildingOperation", false, null, null)] + [InlineData("createResidenceOperation", false, null, null)] + [InlineData("createFamilyHomeOperation", false, null, null)] + [InlineData("createMansionOperation", false, null, null)] + [InlineData("updateBuildingOperation", false, null, null)] + [InlineData("updateResidenceOperation", false, null, null)] + [InlineData("updateFamilyHomeOperation", false, null, null)] + [InlineData("updateMansionOperation", false, null, null)] + [InlineData("deleteBuildingOperation", false, null, null)] + [InlineData("deleteResidenceOperation", false, null, null)] + [InlineData("deleteFamilyHomeOperation", false, null, null)] + [InlineData("deleteMansionOperation", false, null, null)] + [InlineData("updateResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("updateFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("updateMansionStaffRelationshipOperation", false, null, null)] + [InlineData("addToResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("addToFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("addToMansionStaffRelationshipOperation", false, null, null)] + [InlineData("removeFromResidenceRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromFamilyHomeRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionRoomsRelationshipOperation", false, null, null)] + [InlineData("removeFromMansionStaffRelationshipOperation", false, null, null)] + // Room hierarchy: Resource Data + [InlineData("dataInCreateRoomRequest", true, null, null)] + [InlineData("dataInCreateBathroomRequest", false, null, null)] + [InlineData("dataInCreateBedroomRequest", false, null, null)] + [InlineData("dataInCreateKitchenRequest", false, null, null)] + [InlineData("dataInCreateLivingRoomRequest", false, null, null)] + [InlineData("dataInCreateToiletRequest", false, null, null)] + [InlineData("dataInUpdateRoomRequest", true, null, null)] + [InlineData("dataInUpdateBathroomRequest", false, null, null)] + [InlineData("dataInUpdateBedroomRequest", false, null, null)] + [InlineData("dataInUpdateKitchenRequest", false, null, null)] + [InlineData("dataInUpdateLivingRoomRequest", false, null, null)] + [InlineData("dataInUpdateToiletRequest", false, null, null)] + [InlineData("dataInRoomResponse", true, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInBathroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInBedroomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInKitchenResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInLivingRoomResponse", false, "dataInRoomResponse", null)] + [InlineData("dataInToiletResponse", false, "dataInRoomResponse", null)] + // Room hierarchy: Attributes + [InlineData("attributesInCreateRoomRequest", true, null, null)] + [InlineData("attributesInCreateBathroomRequest", false, null, null)] + [InlineData("attributesInCreateBedroomRequest", false, null, null)] + [InlineData("attributesInCreateKitchenRequest", false, null, null)] + [InlineData("attributesInCreateLivingRoomRequest", false, null, null)] + [InlineData("attributesInCreateToiletRequest", false, null, null)] + [InlineData("attributesInUpdateRoomRequest", true, null, null)] + [InlineData("attributesInUpdateBathroomRequest", false, null, null)] + [InlineData("attributesInUpdateBedroomRequest", false, null, null)] + [InlineData("attributesInUpdateKitchenRequest", false, null, null)] + [InlineData("attributesInUpdateLivingRoomRequest", false, null, null)] + [InlineData("attributesInUpdateToiletRequest", false, null, null)] + [InlineData("attributesInRoomResponse", true, "attributesInResponse", "surfaceInSquareMeters")] + [InlineData("attributesInBathroomResponse", false, "attributesInRoomResponse", "hasBath")] + [InlineData("attributesInBedroomResponse", false, "attributesInRoomResponse", "bedCount")] + [InlineData("attributesInKitchenResponse", false, "attributesInRoomResponse", "hasPantry")] + [InlineData("attributesInLivingRoomResponse", false, "attributesInRoomResponse", "hasDiningTable")] + [InlineData("attributesInToiletResponse", false, "attributesInRoomResponse", "hasSink")] + // Room hierarchy: Relationships + [InlineData("relationshipsInCreateRoomRequest", true, null, null)] + [InlineData("relationshipsInCreateBathroomRequest", false, null, null)] + [InlineData("relationshipsInCreateBedroomRequest", false, null, null)] + [InlineData("relationshipsInCreateKitchenRequest", false, null, null)] + [InlineData("relationshipsInCreateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInCreateToiletRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoomRequest", true, null, null)] + [InlineData("relationshipsInUpdateBathroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateBedroomRequest", false, null, null)] + [InlineData("relationshipsInUpdateKitchenRequest", false, null, null)] + [InlineData("relationshipsInUpdateLivingRoomRequest", false, null, null)] + [InlineData("relationshipsInUpdateToiletRequest", false, null, null)] + [InlineData("relationshipsInRoomResponse", true, "relationshipsInResponse", "residence")] + [InlineData("relationshipsInBathroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInBedroomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInKitchenResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInLivingRoomResponse", false, "relationshipsInRoomResponse", null)] + [InlineData("relationshipsInToiletResponse", false, "relationshipsInRoomResponse", null)] + // Room hierarchy: Resource Identifiers + [InlineData("roomIdentifierInRequest", false, "identifierInRequest", "id")] + [InlineData("bathroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("bedroomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("kitchenIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("livingRoomIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("toiletIdentifierInRequest", false, "roomIdentifierInRequest", null)] + [InlineData("roomIdentifierInResponse", true, null, "type|id|meta")] + [InlineData("bathroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("bedroomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("kitchenIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("livingRoomIdentifierInResponse", false, "roomIdentifierInResponse", null)] + [InlineData("toiletIdentifierInResponse", false, "roomIdentifierInResponse", null)] + // Room hierarchy: Atomic Operations + [InlineData("createRoomOperation", false, null, null)] + [InlineData("createBathroomOperation", false, null, null)] + [InlineData("createBedroomOperation", false, null, null)] + [InlineData("createKitchenOperation", false, null, null)] + [InlineData("createLivingRoomOperation", false, null, null)] + [InlineData("createToiletOperation", false, null, null)] + [InlineData("updateRoomOperation", false, null, null)] + [InlineData("updateBathroomOperation", false, null, null)] + [InlineData("updateBedroomOperation", false, null, null)] + [InlineData("updateKitchenOperation", false, null, null)] + [InlineData("updateLivingRoomOperation", false, null, null)] + [InlineData("updateToiletOperation", false, null, null)] + [InlineData("deleteRoomOperation", false, null, null)] + [InlineData("deleteBathroomOperation", false, null, null)] + [InlineData("deleteBedroomOperation", false, null, null)] + [InlineData("deleteKitchenOperation", false, null, null)] + [InlineData("deleteLivingRoomOperation", false, null, null)] + [InlineData("deleteToiletOperation", false, null, null)] + [InlineData("updateRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBathroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateBedroomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateKitchenResidenceRelationshipOperation", false, null, null)] + [InlineData("updateLivingRoomResidenceRelationshipOperation", false, null, null)] + [InlineData("updateToiletResidenceRelationshipOperation", false, null, null)] + // Road hierarchy: Resource Data + [InlineData("dataInCreateRoadRequest", false, null, null)] + [InlineData("dataInCreateCyclePathRequest", false, null, null)] + [InlineData("dataInUpdateRoadRequest", false, null, null)] + [InlineData("dataInUpdateCyclePathRequest", false, null, null)] + [InlineData("dataInRoadResponse", false, "resourceInResponse", "id|attributes|relationships|links")] + [InlineData("dataInCyclePathResponse", false, "dataInRoadResponse", null)] + // Road hierarchy: Attributes + [InlineData("attributesInCreateRoadRequest", false, null, null)] + [InlineData("attributesInCreateCyclePathRequest", false, null, null)] + [InlineData("attributesInUpdateRoadRequest", false, null, null)] + [InlineData("attributesInUpdateCyclePathRequest", false, null, null)] + [InlineData("attributesInRoadResponse", false, "attributesInResponse", "lengthInMeters")] + [InlineData("attributesInCyclePathResponse", false, "attributesInRoadResponse", "hasLaneForPedestrians")] + // Road hierarchy: Relationships + [InlineData("relationshipsInCreateRoadRequest", false, null, null)] + [InlineData("relationshipsInCreateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInUpdateRoadRequest", false, null, null)] + [InlineData("relationshipsInUpdateCyclePathRequest", false, null, null)] + [InlineData("relationshipsInRoadResponse", false, "relationshipsInResponse", null)] + [InlineData("relationshipsInCyclePathResponse", false, "relationshipsInRoadResponse", null)] + // Road hierarchy: Resource Identifiers + [InlineData("roadIdentifierInRequest", false, null, null)] + [InlineData("cyclePathIdentifierInRequest", false, null, null)] + [InlineData("roadIdentifierInResponse", false, null, "type|id|meta")] + [InlineData("cyclePathIdentifierInResponse", false, "roadIdentifierInResponse", null)] + // Road hierarchy: Atomic Operations + [InlineData("createRoadOperation", false, null, null)] + [InlineData("createCyclePathOperation", false, null, null)] + [InlineData("updateRoadOperation", false, null, null)] + [InlineData("updateCyclePathOperation", false, null, null)] + [InlineData("deleteRoadOperation", false, null, null)] + [InlineData("deleteCyclePathOperation", false, null, null)] + public override async Task Component_schemas_have_expected_base_type(string schemaName, bool isAbstract, string? baseType, string? properties) + { + await base.Component_schemas_have_expected_base_type(schemaName, isAbstract, baseType, properties); + } +} diff --git a/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs new file mode 100644 index 0000000000..8543e1d86f --- /dev/null +++ b/test/OpenApiTests/ResourceInheritance/SubsetOfVarious/SubsetOfVariousOperationFilter.cs @@ -0,0 +1,36 @@ +using JsonApiDotNetCore.AtomicOperations; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using OpenApiTests.ResourceInheritance.Models; + +namespace OpenApiTests.ResourceInheritance.SubsetOfVarious; + +public sealed class SubsetOfVariousOperationFilter : DefaultOperationFilter +{ + protected override JsonApiEndpoints? GetJsonApiEndpoints(ResourceType resourceType) + { + Type resourceClrType = resourceType.ClrType; + + if (resourceClrType == typeof(District)) + { + return JsonApiEndpoints.GetCollection; + } + + if (resourceClrType == typeof(Building)) + { + return JsonApiEndpoints.Post | JsonApiEndpoints.Patch; + } + + if (resourceClrType == typeof(FamilyHome)) + { + return JsonApiEndpoints.GetRelationship; + } + + if (resourceClrType == typeof(CyclePath)) + { + return JsonApiEndpoints.GetSingle; + } + + return JsonApiEndpoints.None; + } +} diff --git a/test/OpenApiTests/RestrictedControllers/Channel.cs b/test/OpenApiTests/RestrictedControllers/Channel.cs new file mode 100644 index 0000000000..a91555582d --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/Channel.cs @@ -0,0 +1,27 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public abstract class Channel : Identifiable +{ + [Attr] + public string? Name { get; set; } + + [Attr] + public bool? IsCommercial { get; set; } + + [Attr] + public bool? IsAdultOnly { get; set; } + + [HasOne] + public DataStream VideoStream { get; set; } = null!; + + [HasOne] + public DataStream? UltraHighDefinitionVideoStream { get; set; } + + [HasMany] + public ISet AudioStreams { get; set; } = new HashSet(); +} diff --git a/test/OpenApiTests/RestrictedControllers/DataStream.cs b/test/OpenApiTests/RestrictedControllers/DataStream.cs new file mode 100644 index 0000000000..a92ef3e76b --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/DataStream.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.RestrictedControllers", GenerateControllerEndpoints = JsonApiEndpoints.None)] +#pragma warning disable CA1711 // Identifiers should not have incorrect suffix +public sealed class DataStream : Identifiable +#pragma warning restore CA1711 // Identifiers should not have incorrect suffix +{ + [Attr] + [Required] + public ulong? BytesTransmitted { get; set; } +} diff --git a/test/OpenApiTests/RestrictedControllers/DataStreamController.cs b/test/OpenApiTests/RestrictedControllers/DataStreamController.cs new file mode 100644 index 0000000000..1496d51dfb --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/DataStreamController.cs @@ -0,0 +1,26 @@ +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace OpenApiTests.RestrictedControllers; + +public sealed class DataStreamController( + IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IResourceService resourceService) + : BaseJsonApiController(options, resourceGraph, loggerFactory, resourceService) +{ + [HttpGet] + [HttpHead] + public override Task GetAsync(CancellationToken cancellationToken) + { + return base.GetAsync(cancellationToken); + } + + [HttpGet("{id}")] + [HttpHead("{id}")] + public override Task GetAsync(long id, CancellationToken cancellationToken) + { + return base.GetAsync(id, cancellationToken); + } +} diff --git a/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json new file mode 100644 index 0000000000..51cc607974 --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json @@ -0,0 +1,5914 @@ +{ + "openapi": "3.0.4", + "info": { + "title": "OpenApiTests", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost" + } + ], + "paths": { + "/dataStreams": { + "get": { + "tags": [ + "dataStreams" + ], + "summary": "Retrieves a collection of dataStreams.", + "operationId": "getDataStreamCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStreams, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "dataStreams" + ], + "summary": "Retrieves a collection of dataStreams without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDataStreamCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + } + }, + "/dataStreams/{id}": { + "get": { + "tags": [ + "dataStreams" + ], + "summary": "Retrieves an individual dataStream by its identifier.", + "operationId": "getDataStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryDataStreamResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The dataStream does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "dataStreams" + ], + "summary": "Retrieves an individual dataStream by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headDataStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The dataStream does not exist." + } + } + } + }, + "/readOnlyChannels": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves a collection of readOnlyChannels.", + "operationId": "getReadOnlyChannelCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found readOnlyChannels, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/readOnlyChannelCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves a collection of readOnlyChannels without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + } + }, + "/readOnlyChannels/{id}": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves an individual readOnlyChannel by its identifier.", + "operationId": "getReadOnlyChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found readOnlyChannel.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryReadOnlyChannelResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves an individual readOnlyChannel by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/audioStreams": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStreams of an individual readOnlyChannel's audioStreams relationship.", + "operationId": "getReadOnlyChannelAudioStreams", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStreams to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStreams, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStreams of an individual readOnlyChannel's audioStreams relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelAudioStreams", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStreams to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/relationships/audioStreams": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identities of an individual readOnlyChannel's audioStreams relationship.", + "operationId": "getReadOnlyChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identities of an individual readOnlyChannel's audioStreams relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/ultraHighDefinitionVideoStream": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship.", + "operationId": "getReadOnlyChannelUltraHighDefinitionVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryDataStreamResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelUltraHighDefinitionVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship.", + "operationId": "getReadOnlyChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableDataStreamIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual readOnlyChannel's ultraHighDefinitionVideoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/videoStream": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship.", + "operationId": "getReadOnlyChannelVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryDataStreamResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyChannel's videoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyChannels/{id}/relationships/videoStream": { + "get": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual readOnlyChannel's videoStream relationship.", + "operationId": "getReadOnlyChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual readOnlyChannel's videoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyChannel does not exist." + } + } + } + }, + "/readOnlyResourceChannels": { + "get": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves a collection of readOnlyResourceChannels.", + "operationId": "getReadOnlyResourceChannelCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found readOnlyResourceChannels, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/readOnlyResourceChannelCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves a collection of readOnlyResourceChannels without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyResourceChannelCollection", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + } + } + } + }, + "/readOnlyResourceChannels/{id}": { + "get": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves an individual readOnlyResourceChannel by its identifier.", + "operationId": "getReadOnlyResourceChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found readOnlyResourceChannel.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryReadOnlyResourceChannelResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyResourceChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves an individual readOnlyResourceChannel by its identifier without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyResourceChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyResourceChannel does not exist." + } + } + } + }, + "/readOnlyResourceChannels/{id}/audioStreams": { + "get": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStreams of an individual readOnlyResourceChannel's audioStreams relationship.", + "operationId": "getReadOnlyResourceChannelAudioStreams", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStreams to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStreams, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyResourceChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStreams of an individual readOnlyResourceChannel's audioStreams relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyResourceChannelAudioStreams", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStreams to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyResourceChannel does not exist." + } + } + } + }, + "/readOnlyResourceChannels/{id}/ultraHighDefinitionVideoStream": { + "get": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship.", + "operationId": "getReadOnlyResourceChannelUltraHighDefinitionVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableSecondaryDataStreamResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyResourceChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyResourceChannel's ultraHighDefinitionVideoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyResourceChannelUltraHighDefinitionVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyResourceChannel does not exist." + } + } + } + }, + "/readOnlyResourceChannels/{id}/videoStream": { + "get": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship.", + "operationId": "getReadOnlyResourceChannelVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/secondaryDataStreamResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The readOnlyResourceChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "readOnlyResourceChannels" + ], + "summary": "Retrieves the related dataStream of an individual readOnlyResourceChannel's videoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headReadOnlyResourceChannelVideoStream", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the readOnlyResourceChannel whose related dataStream to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The readOnlyResourceChannel does not exist." + } + } + } + }, + "/relationshipChannels/{id}/relationships/audioStreams": { + "get": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identities of an individual relationshipChannel's audioStreams relationship.", + "operationId": "getRelationshipChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identities, or an empty array if none were found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamIdentifierCollectionResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identities of an individual relationshipChannel's audioStreams relationship without returning them.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRelationshipChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identities to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The relationshipChannel does not exist." + } + } + }, + "post": { + "tags": [ + "relationshipChannels" + ], + "summary": "Adds existing dataStreams to the audioStreams relationship of an individual relationshipChannel.", + "operationId": "postRelationshipChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel to add dataStreams to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to add to the audioStreams relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The dataStreams were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "relationshipChannels" + ], + "summary": "Assigns existing dataStreams to the audioStreams relationship of an individual relationshipChannel.", + "operationId": "patchRelationshipChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose audioStreams relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to assign to the audioStreams relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The audioStreams relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "relationshipChannels" + ], + "summary": "Removes existing dataStreams from the audioStreams relationship of an individual relationshipChannel.", + "operationId": "deleteRelationshipChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel to remove dataStreams from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to remove from the audioStreams relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The dataStreams were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/relationshipChannels/{id}/relationships/ultraHighDefinitionVideoStream": { + "get": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual relationshipChannel's ultraHighDefinitionVideoStream relationship.", + "operationId": "getRelationshipChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/nullableDataStreamIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual relationshipChannel's ultraHighDefinitionVideoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRelationshipChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The relationshipChannel does not exist." + } + } + }, + "patch": { + "tags": [ + "relationshipChannels" + ], + "summary": "Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual relationshipChannel.", + "operationId": "patchRelationshipChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose ultraHighDefinitionVideoStream relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the dataStream to assign to the ultraHighDefinitionVideoStream relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The ultraHighDefinitionVideoStream relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/relationshipChannels/{id}/relationships/videoStream": { + "get": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual relationshipChannel's videoStream relationship.", + "operationId": "getRelationshipChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successfully returns the found dataStream identity, or `null` if it was not found.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/dataStreamIdentifierResponseDocument" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "head": { + "tags": [ + "relationshipChannels" + ], + "summary": "Retrieves the related dataStream identity of an individual relationshipChannel's videoStream relationship without returning it.", + "description": "Compare the returned ETag HTTP header with an earlier one to determine if the response has changed since it was fetched.", + "operationId": "headRelationshipChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose related dataStream identity to retrieve.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + }, + { + "name": "If-None-Match", + "in": "header", + "description": "A list of ETags, resulting in HTTP status 304 without a body, if one of them matches the current fingerprint.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The operation completed successfully.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + }, + "Content-Length": { + "description": "Size of the HTTP response body, in bytes.", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "304": { + "description": "The fingerprint of the HTTP response matches one of the ETags from the incoming If-None-Match header.", + "headers": { + "ETag": { + "description": "A fingerprint of the HTTP response, which can be used in an If-None-Match header to only fetch changes.", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "The query string is invalid." + }, + "404": { + "description": "The relationshipChannel does not exist." + } + } + }, + "patch": { + "tags": [ + "relationshipChannels" + ], + "summary": "Assigns an existing dataStream to the videoStream relationship of an individual relationshipChannel.", + "operationId": "patchRelationshipChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the relationshipChannel whose videoStream relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the dataStream to assign to the videoStream relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The videoStream relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The relationshipChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/writeOnlyChannels": { + "post": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Creates a new writeOnlyChannel.", + "operationId": "postWriteOnlyChannel", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the writeOnlyChannel to create.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/createWriteOnlyChannelRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "The writeOnlyChannel was successfully created, which resulted in additional changes. The newly created writeOnlyChannel is returned.", + "headers": { + "Location": { + "description": "The URL at which the newly created writeOnlyChannel can be retrieved.", + "required": true, + "schema": { + "type": "string", + "format": "uri" + } + } + }, + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryWriteOnlyChannelResponseDocument" + } + } + } + }, + "204": { + "description": "The writeOnlyChannel was successfully created, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "403": { + "description": "Client-generated IDs cannot be used at this endpoint.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "A related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/writeOnlyChannels/{id}": { + "patch": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Updates an existing writeOnlyChannel.", + "operationId": "patchWriteOnlyChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel to update.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + { + "name": "query", + "in": "query", + "description": "For syntax, see the documentation for the [`include`](https://www.jsonapi.net/usage/reading/including-relationships.html)/[`filter`](https://www.jsonapi.net/usage/reading/filtering.html)/[`sort`](https://www.jsonapi.net/usage/reading/sorting.html)/[`page`](https://www.jsonapi.net/usage/reading/pagination.html)/[`fields`](https://www.jsonapi.net/usage/reading/sparse-fieldset-selection.html) query string parameters.", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string", + "nullable": true + }, + "example": "" + } + } + ], + "requestBody": { + "description": "The attributes and relationships of the writeOnlyChannel to update. Omitted fields are left unchanged.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/updateWriteOnlyChannelRequestDocument" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "The writeOnlyChannel was successfully updated, which resulted in additional changes. The updated writeOnlyChannel is returned.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/primaryWriteOnlyChannelResponseDocument" + } + } + } + }, + "204": { + "description": "The writeOnlyChannel was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The query string is invalid or the request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "A resource type or identifier in the request body is incompatible.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Deletes an existing writeOnlyChannel by its identifier.", + "operationId": "deleteWriteOnlyChannel", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel to delete.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "The writeOnlyChannel was successfully deleted." + }, + "404": { + "description": "The writeOnlyChannel does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/writeOnlyChannels/{id}/relationships/audioStreams": { + "post": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Adds existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel.", + "operationId": "postWriteOnlyChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel to add dataStreams to.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to add to the audioStreams relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The dataStreams were successfully added, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Assigns existing dataStreams to the audioStreams relationship of an individual writeOnlyChannel.", + "operationId": "patchWriteOnlyChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel whose audioStreams relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to assign to the audioStreams relationship, or an empty array to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The audioStreams relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + }, + "delete": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Removes existing dataStreams from the audioStreams relationship of an individual writeOnlyChannel.", + "operationId": "deleteWriteOnlyChannelAudioStreamsRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel to remove dataStreams from.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identities of the dataStreams to remove from the audioStreams relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The dataStreams were successfully removed, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/writeOnlyChannels/{id}/relationships/ultraHighDefinitionVideoStream": { + "patch": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Clears or assigns an existing dataStream to the ultraHighDefinitionVideoStream relationship of an individual writeOnlyChannel.", + "operationId": "patchWriteOnlyChannelUltraHighDefinitionVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel whose ultraHighDefinitionVideoStream relationship to assign or clear.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the dataStream to assign to the ultraHighDefinitionVideoStream relationship, or `null` to clear the relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The ultraHighDefinitionVideoStream relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + }, + "/writeOnlyChannels/{id}/relationships/videoStream": { + "patch": { + "tags": [ + "writeOnlyChannels" + ], + "summary": "Assigns an existing dataStream to the videoStream relationship of an individual writeOnlyChannel.", + "operationId": "patchWriteOnlyChannelVideoStreamRelationship", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The identifier of the writeOnlyChannel whose videoStream relationship to assign.", + "required": true, + "schema": { + "minLength": 1, + "type": "string", + "format": "int64" + } + } + ], + "requestBody": { + "description": "The identity of the dataStream to assign to the videoStream relationship.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The videoStream relationship was successfully updated, which did not result in additional changes." + }, + "400": { + "description": "The request body is missing or malformed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "404": { + "description": "The writeOnlyChannel or a related resource does not exist.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "409": { + "description": "The request body contains conflicting information or another resource with the same ID already exists.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + }, + "422": { + "description": "Validation of the request body failed.", + "content": { + "application/vnd.api+json; ext=openapi": { + "schema": { + "$ref": "#/components/schemas/errorResponseDocument" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "attributesInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/attributesInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "attributesInCreateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInDataStreamResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "bytesTransmitted": { + "type": "integer", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "dataStreams": "#/components/schemas/attributesInDataStreamResponse", + "readOnlyChannels": "#/components/schemas/attributesInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/attributesInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/attributesInWriteOnlyChannelResponse" + } + }, + "x-abstract": true + }, + "attributesInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/attributesInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "attributesInUpdateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateRequest" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "attributesInWriteOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInResponse" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "isCommercial": { + "type": "boolean", + "nullable": true + }, + "isAdultOnly": { + "type": "boolean", + "nullable": true + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "createWriteOnlyChannelRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataInCreateWriteOnlyChannelRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInCreateRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInCreateWriteOnlyChannelRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInDataStreamResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInDataStreamResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInReadOnlyChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInReadOnlyChannelResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInReadOnlyResourceChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInReadOnlyResourceChannelResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInUpdateWriteOnlyChannelRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/resourceInUpdateRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInUpdateWriteOnlyChannelRequest" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataInWriteOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceInResponse" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/attributesInWriteOnlyChannelResponse" + } + ] + }, + "relationships": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInWriteOnlyChannelResponse" + } + ] + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceLinks" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataStreamCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataStreamIdentifierCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataStreamIdentifierInRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/identifierInRequest" + }, + { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "dataStreamIdentifierInResponse": { + "required": [ + "id", + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamResourceType" + } + ] + }, + "id": { + "minLength": 1, + "type": "string", + "format": "int64" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataStreamIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "dataStreamResourceType": { + "enum": [ + "dataStreams" + ], + "type": "string" + }, + "errorLinks": { + "type": "object", + "properties": { + "about": { + "type": "string", + "nullable": true + }, + "type": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorObject": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorLinks" + } + ], + "nullable": true + }, + "status": { + "type": "string" + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "source": { + "allOf": [ + { + "$ref": "#/components/schemas/errorSource" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorResponseDocument": { + "required": [ + "errors", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/errorTopLevelLinks" + } + ] + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/errorObject" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "errorSource": { + "type": "object", + "properties": { + "pointer": { + "type": "string", + "nullable": true + }, + "parameter": { + "type": "string", + "nullable": true + }, + "header": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "errorTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "identifierInRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "dataStreams": "#/components/schemas/dataStreamIdentifierInRequest" + } + }, + "x-abstract": true + }, + "meta": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "nullableDataStreamIdentifierResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceIdentifierTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableSecondaryDataStreamResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + ], + "nullable": true + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneDataStreamInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInRequest" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "nullableToOneDataStreamInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + ], + "nullable": true + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryDataStreamResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryReadOnlyChannelResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInReadOnlyChannelResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryReadOnlyResourceChannelResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInReadOnlyResourceChannelResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "primaryWriteOnlyChannelResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInWriteOnlyChannelResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "readOnlyChannelCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInReadOnlyChannelResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "readOnlyResourceChannelCollectionResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceCollectionTopLevelLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataInReadOnlyResourceChannelResponse" + } + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "relationshipLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + } + }, + "additionalProperties": false + }, + "relationshipsInCreateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/relationshipsInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "relationshipsInCreateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInCreateRequest" + }, + { + "required": [ + "videoStream" + ], + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInReadOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInReadOnlyResourceChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInResponse": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "readOnlyChannels": "#/components/schemas/relationshipsInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/relationshipsInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/relationshipsInWriteOnlyChannelResponse" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateRequest": { + "required": [ + "openapi:discriminator" + ], + "type": "object", + "properties": { + "openapi:discriminator": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "openapi:discriminator", + "mapping": { + "writeOnlyChannels": "#/components/schemas/relationshipsInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "relationshipsInUpdateWriteOnlyChannelRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInUpdateRequest" + }, + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInRequest" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInRequest" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInRequest" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "relationshipsInWriteOnlyChannelResponse": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipsInResponse" + }, + { + "type": "object", + "properties": { + "videoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/toOneDataStreamInResponse" + } + ] + }, + "ultraHighDefinitionVideoStream": { + "allOf": [ + { + "$ref": "#/components/schemas/nullableToOneDataStreamInResponse" + } + ] + }, + "audioStreams": { + "allOf": [ + { + "$ref": "#/components/schemas/toManyDataStreamInResponse" + } + ] + } + }, + "additionalProperties": false + } + ], + "additionalProperties": false + }, + "resourceCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierCollectionTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + }, + "first": { + "type": "string" + }, + "last": { + "type": "string" + }, + "prev": { + "type": "string" + }, + "next": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceIdentifierTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "related": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceInCreateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "writeOnlyChannels": "#/components/schemas/dataInCreateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "resourceInResponse": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "dataStreams": "#/components/schemas/dataInDataStreamResponse", + "readOnlyChannels": "#/components/schemas/dataInReadOnlyChannelResponse", + "readOnlyResourceChannels": "#/components/schemas/dataInReadOnlyResourceChannelResponse", + "writeOnlyChannels": "#/components/schemas/dataInWriteOnlyChannelResponse" + } + }, + "x-abstract": true + }, + "resourceInUpdateRequest": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceType" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "type", + "mapping": { + "writeOnlyChannels": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" + } + }, + "x-abstract": true + }, + "resourceLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceTopLevelLinks": { + "type": "object", + "properties": { + "self": { + "type": "string" + }, + "describedby": { + "type": "string" + } + }, + "additionalProperties": false + }, + "resourceType": { + "enum": [ + "dataStreams", + "readOnlyChannels", + "readOnlyResourceChannels", + "writeOnlyChannels" + ], + "type": "string" + }, + "secondaryDataStreamResponseDocument": { + "required": [ + "data", + "links" + ], + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/resourceTopLevelLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInDataStreamResponse" + } + ] + }, + "included": { + "type": "array", + "items": { + "$ref": "#/components/schemas/resourceInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyDataStreamInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInRequest" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toManyDataStreamInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneDataStreamInRequest": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "toOneDataStreamInResponse": { + "type": "object", + "properties": { + "links": { + "allOf": [ + { + "$ref": "#/components/schemas/relationshipLinks" + } + ] + }, + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataStreamIdentifierInResponse" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + }, + "updateWriteOnlyChannelRequestDocument": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/dataInUpdateWriteOnlyChannelRequest" + } + ] + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/meta" + } + ] + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/OpenApiTests/RestrictedControllers/ReadOnlyChannel.cs b/test/OpenApiTests/RestrictedControllers/ReadOnlyChannel.cs new file mode 100644 index 0000000000..50f3094eaa --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/ReadOnlyChannel.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.RestrictedControllers", GenerateControllerEndpoints = ControllerEndpoints)] +public sealed class ReadOnlyChannel : Channel +{ + internal const JsonApiEndpoints ControllerEndpoints = JsonApiEndpoints.Query; +} diff --git a/test/OpenApiTests/RestrictedControllers/ReadOnlyResourceChannel.cs b/test/OpenApiTests/RestrictedControllers/ReadOnlyResourceChannel.cs new file mode 100644 index 0000000000..483a83b0d6 --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/ReadOnlyResourceChannel.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.RestrictedControllers", GenerateControllerEndpoints = ControllerEndpoints)] +public sealed class ReadOnlyResourceChannel : Channel +{ + internal const JsonApiEndpoints ControllerEndpoints = JsonApiEndpoints.GetCollection | JsonApiEndpoints.GetSingle | JsonApiEndpoints.GetSecondary; +} diff --git a/test/OpenApiTests/RestrictedControllers/RelationshipChannel.cs b/test/OpenApiTests/RestrictedControllers/RelationshipChannel.cs new file mode 100644 index 0000000000..f24b900af0 --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/RelationshipChannel.cs @@ -0,0 +1,13 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.RestrictedControllers", GenerateControllerEndpoints = ControllerEndpoints)] +public sealed class RelationshipChannel : Channel +{ + internal const JsonApiEndpoints ControllerEndpoints = JsonApiEndpoints.GetRelationship | JsonApiEndpoints.PostRelationship | + JsonApiEndpoints.PatchRelationship | JsonApiEndpoints.DeleteRelationship; +} diff --git a/test/OpenApiTests/RestrictedControllers/RestrictionDbContext.cs b/test/OpenApiTests/RestrictedControllers/RestrictionDbContext.cs new file mode 100644 index 0000000000..65173856aa --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/RestrictionDbContext.cs @@ -0,0 +1,16 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using TestBuildingBlocks; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class RestrictionDbContext(DbContextOptions options) + : TestableDbContext(options) +{ + public DbSet DataStreams => Set(); + public DbSet ReadOnlyChannels => Set(); + public DbSet WriteOnlyChannels => Set(); + public DbSet RelationshipChannels => Set(); + public DbSet ReadOnlyResourceChannels => Set(); +} diff --git a/test/OpenApiTests/RestrictedControllers/RestrictionFakers.cs b/test/OpenApiTests/RestrictedControllers/RestrictionFakers.cs new file mode 100644 index 0000000000..f1d97e8d4a --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/RestrictionFakers.cs @@ -0,0 +1,53 @@ +using Bogus; +using JetBrains.Annotations; +using TestBuildingBlocks; + +// @formatter:wrap_chained_method_calls chop_if_long +// @formatter:wrap_before_first_method_call true + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +public sealed class RestrictionFakers +{ + private static readonly bool?[] NullableBooleanValues = + [ + true, + false, + null + ]; + + private readonly Lazy> _lazyDataStreamFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(stream => stream.BytesTransmitted, faker => (ulong)faker.Random.Long(0))); + + private readonly Lazy> _lazyReadOnlyChannelFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(channel => channel.Name, faker => faker.Lorem.Word()) + .RuleFor(channel => channel.IsCommercial, faker => faker.PickRandom(NullableBooleanValues)) + .RuleFor(channel => channel.IsAdultOnly, faker => faker.PickRandom(NullableBooleanValues))); + + private readonly Lazy> _lazyWriteOnlyChannelFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(channel => channel.Name, faker => faker.Lorem.Word()) + .RuleFor(channel => channel.IsCommercial, faker => faker.PickRandom(NullableBooleanValues)) + .RuleFor(channel => channel.IsAdultOnly, faker => faker.PickRandom(NullableBooleanValues))); + + private readonly Lazy> _lazyRelationshipChannelFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(channel => channel.Name, faker => faker.Lorem.Word()) + .RuleFor(channel => channel.IsCommercial, faker => faker.PickRandom(NullableBooleanValues)) + .RuleFor(channel => channel.IsAdultOnly, faker => faker.PickRandom(NullableBooleanValues))); + + private readonly Lazy> _lazyReadOnlyResourceChannelFaker = new(() => new Faker() + .MakeDeterministic() + .RuleFor(channel => channel.Name, faker => faker.Lorem.Word()) + .RuleFor(channel => channel.IsCommercial, faker => faker.PickRandom(NullableBooleanValues)) + .RuleFor(channel => channel.IsAdultOnly, faker => faker.PickRandom(NullableBooleanValues))); + + public Faker DataStream => _lazyDataStreamFaker.Value; + public Faker ReadOnlyChannel => _lazyReadOnlyChannelFaker.Value; + public Faker WriteOnlyChannel => _lazyWriteOnlyChannelFaker.Value; + public Faker RelationshipChannel => _lazyRelationshipChannelFaker.Value; + public Faker ReadOnlyResourceChannel => _lazyReadOnlyResourceChannelFaker.Value; +} diff --git a/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs b/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs new file mode 100644 index 0000000000..061b6b4733 --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/RestrictionTests.cs @@ -0,0 +1,62 @@ +using System.Collections.ObjectModel; +using System.Text.Json; +using JsonApiDotNetCore.Configuration; +using JsonApiDotNetCore.Controllers; +using Microsoft.Extensions.DependencyInjection; +using TestBuildingBlocks; +using Xunit; +using Xunit.Abstractions; + +namespace OpenApiTests.RestrictedControllers; + +public sealed class RestrictionTests : IClassFixture, RestrictionDbContext>> +{ + private readonly OpenApiTestContext, RestrictionDbContext> _testContext; + + public RestrictionTests(OpenApiTestContext, RestrictionDbContext> testContext, ITestOutputHelper testOutputHelper) + { + _testContext = testContext; + + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + testContext.UseController(); + + testContext.SetTestOutputHelper(testOutputHelper); + testContext.SwaggerDocumentOutputDirectory = $"{GetType().Namespace!.Replace('.', '/')}/GeneratedSwagger"; + } + + [Theory] + [InlineData(typeof(DataStream), JsonApiEndpoints.GetCollection | JsonApiEndpoints.GetSingle)] + [InlineData(typeof(ReadOnlyChannel), ReadOnlyChannel.ControllerEndpoints)] + [InlineData(typeof(WriteOnlyChannel), WriteOnlyChannel.ControllerEndpoints)] + [InlineData(typeof(RelationshipChannel), RelationshipChannel.ControllerEndpoints)] + [InlineData(typeof(ReadOnlyResourceChannel), ReadOnlyResourceChannel.ControllerEndpoints)] + public async Task Only_expected_endpoints_are_exposed(Type resourceClrType, JsonApiEndpoints expected) + { + // Arrange + var resourceGraph = _testContext.Factory.Services.GetRequiredService(); + ResourceType resourceType = resourceGraph.GetResourceType(resourceClrType); + IReadOnlyDictionary> endpointToPathMap = JsonPathBuilder.GetEndpointPaths(resourceType); + + // Act + JsonElement document = await _testContext.GetSwaggerDocumentAsync(); + + // Assert + string[] pathsExpected = JsonPathBuilder.KnownEndpoints.Where(endpoint => expected.HasFlag(endpoint)) + .SelectMany(endpoint => endpointToPathMap[endpoint]).ToArray(); + + string[] pathsNotExpected = endpointToPathMap.Values.SelectMany(paths => paths).Except(pathsExpected).ToArray(); + + foreach (string path in pathsExpected) + { + document.Should().ContainPath(path); + } + + foreach (string path in pathsNotExpected) + { + document.Should().NotContainPath(path); + } + } +} diff --git a/test/OpenApiTests/RestrictedControllers/WriteOnlyChannel.cs b/test/OpenApiTests/RestrictedControllers/WriteOnlyChannel.cs new file mode 100644 index 0000000000..75c576fb87 --- /dev/null +++ b/test/OpenApiTests/RestrictedControllers/WriteOnlyChannel.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using JsonApiDotNetCore.Controllers; +using JsonApiDotNetCore.Resources.Annotations; + +namespace OpenApiTests.RestrictedControllers; + +[UsedImplicitly(ImplicitUseTargetFlags.Members)] +[Resource(ControllerNamespace = "OpenApiTests.RestrictedControllers", GenerateControllerEndpoints = ControllerEndpoints)] +public sealed class WriteOnlyChannel : Channel +{ + internal const JsonApiEndpoints ControllerEndpoints = JsonApiEndpoints.Command; +} diff --git a/test/TestBuildingBlocks/FakerExtensions.cs b/test/TestBuildingBlocks/FakerExtensions.cs index a070870342..b6cb073e8c 100644 --- a/test/TestBuildingBlocks/FakerExtensions.cs +++ b/test/TestBuildingBlocks/FakerExtensions.cs @@ -20,7 +20,9 @@ public static Faker MakeDeterministic(this Faker faker, DateTime? syste return faker; } - private static int GetFakerSeed() +#pragma warning disable AV1008 // Class should not be static + public static int GetFakerSeed() +#pragma warning restore AV1008 // Class should not be static { // The goal here is to have stable data over multiple test runs, but at the same time different data per test case. diff --git a/test/TestBuildingBlocks/FluentJsonElementExtensions.cs b/test/TestBuildingBlocks/FluentJsonElementExtensions.cs new file mode 100644 index 0000000000..76610ee881 --- /dev/null +++ b/test/TestBuildingBlocks/FluentJsonElementExtensions.cs @@ -0,0 +1,156 @@ +using System.Text.Json; +using BlushingPenguin.JsonPath; +using FluentAssertions; +using FluentAssertions.Execution; +using JetBrains.Annotations; + +namespace TestBuildingBlocks; + +public static class FluentJsonElementExtensions +{ + private const string ComponentSchemaPrefix = "#/components/schemas/"; + + public static JsonElementAssertions Should(this JsonElement source) + { + return new JsonElementAssertions(source); + } + + [CustomAssertion] + public static SchemaReferenceIdContainer ShouldBeSchemaReferenceId(this JsonElement source, string value) + { + string schemaReferenceId = GetSchemaReferenceId(source); + schemaReferenceId.Should().Be(value); + + return new SchemaReferenceIdContainer(value); + } + + [CustomAssertion] + public static string GetSchemaReferenceId(this JsonElement source) + { + source.ValueKind.Should().Be(JsonValueKind.String); + + string? jsonElementValue = source.GetString(); + jsonElementValue.Should().StartWith(ComponentSchemaPrefix); + + return jsonElementValue[ComponentSchemaPrefix.Length..]; + } + + [CustomAssertion] + public static void WithSchemaReferenceId(this JsonElement subject, [InstantHandle] Action continuation) + { + string schemaReferenceId = GetSchemaReferenceId(subject); + + continuation(schemaReferenceId); + } + + public sealed class SchemaReferenceIdContainer + { + public string SchemaReferenceId { get; } + + internal SchemaReferenceIdContainer(string schemaReferenceId) + { + SchemaReferenceId = schemaReferenceId; + } + } + + public sealed class JsonElementAssertions : JsonElementAssertions + { + internal JsonElementAssertions(JsonElement subject) + : base(subject) + { + } + } + + public class JsonElementAssertions + where TAssertions : JsonElementAssertions + { + private readonly JsonElement _subject; + + protected JsonElementAssertions(JsonElement subject) + { + _subject = subject; + } + + public void ContainProperty(string propertyName) + { + string json = _subject.ToString(); + string escapedJson = json.Replace("{", "{{").Replace("}", "}}"); + + Execute.Assertion.ForCondition(_subject.TryGetProperty(propertyName, out _)) + .FailWith($"Expected JSON element '{escapedJson}' to contain a property named '{propertyName}'."); + } + + public JsonElement ContainPath(string jsonPath) + { + Func elementSelector = () => _subject.SelectToken(jsonPath, true)!.Value; + return elementSelector.Should().NotThrow().Subject; + } + + public void NotContainPath(string jsonPath) + { + JsonElement? pathToken = _subject.SelectToken(jsonPath); + pathToken.Should().BeNull(); + } + + public void Be(object? value) + { + if (value == null) + { + _subject.ValueKind.Should().Be(JsonValueKind.Null); + } + else if (value is bool boolValue) + { + _subject.ValueKind.Should().Be(boolValue ? JsonValueKind.True : JsonValueKind.False); + } + else if (value is int intValue) + { + _subject.ValueKind.Should().Be(JsonValueKind.Number); + _subject.GetInt32().Should().Be(intValue); + } + else if (value is double doubleValue) + { + _subject.ValueKind.Should().Be(JsonValueKind.Number); + _subject.GetDouble().Should().Be(doubleValue); + } + else if (value is string stringValue) + { + _subject.ValueKind.Should().Be(JsonValueKind.String); + _subject.GetString().Should().Be(stringValue); + } + else + { + throw new NotSupportedException($"Unknown object of type '{value.GetType()}'."); + } + } + + public void HaveProperty(string jsonPath, object? propertyValue) + { + _subject.Should().ContainPath(jsonPath).With(element => element.Should().Be(propertyValue)); + } + + public void ContainArrayElement(string value) + { + _subject.ValueKind.Should().Be(JsonValueKind.Array); + + string?[] stringValues = _subject.EnumerateArray().Where(element => element.ValueKind == JsonValueKind.String) + .Select(element => element.GetString()).ToArray(); + + stringValues.Should().Contain(value); + } + + public void NotContainArrayElement(string value) + { + _subject.ValueKind.Should().Be(JsonValueKind.Array); + + string?[] stringValues = _subject.EnumerateArray().Where(element => element.ValueKind == JsonValueKind.String) + .Select(element => element.GetString()).ToArray(); + + stringValues.Should().NotContain(value); + } + + public void BeJson(string json) + { + _subject.ToString().Should().BeJson(json); + } + } +} diff --git a/test/TestBuildingBlocks/HttpRequestHeadersExtensions.cs b/test/TestBuildingBlocks/HttpRequestHeadersExtensions.cs new file mode 100644 index 0000000000..8a784ec759 --- /dev/null +++ b/test/TestBuildingBlocks/HttpRequestHeadersExtensions.cs @@ -0,0 +1,16 @@ +using System.Net.Http.Headers; +using Microsoft.Extensions.Primitives; + +namespace TestBuildingBlocks; + +public static class HttpRequestHeadersExtensions +{ + /// + /// Returns the value of the specified HTTP request header, or null when not found. If the header occurs multiple times, their values are + /// collapsed into a comma-separated string, without changing any surrounding double quotes. + /// + public static string? GetValue(this HttpRequestHeaders requestHeaders, string name) + { + return requestHeaders.TryGetValues(name, out IEnumerable? values) ? new StringValues(values.ToArray()).ToString() : null; + } +} diff --git a/test/TestBuildingBlocks/IntegrationTestContext.cs b/test/TestBuildingBlocks/IntegrationTestContext.cs index c895765a3e..4876388c3a 100644 --- a/test/TestBuildingBlocks/IntegrationTestContext.cs +++ b/test/TestBuildingBlocks/IntegrationTestContext.cs @@ -106,17 +106,32 @@ private static void SetDbContextDebugOptions(DbContextOptionsBuilder options) public void ConfigureLogging(Action loggingConfiguration) { + if (_loggingConfiguration != null && _loggingConfiguration != loggingConfiguration) + { + throw new InvalidOperationException($"Do not call {nameof(ConfigureLogging)} multiple times."); + } + _loggingConfiguration = loggingConfiguration; } public void ConfigureServices(Action configureServices) { + if (_configureServices != null && _configureServices != configureServices) + { + throw new InvalidOperationException($"Do not call {nameof(ConfigureServices)} multiple times."); + } + _configureServices = configureServices; } - public void PostConfigureServices(Action configureServices) + public void PostConfigureServices(Action postConfigureServices) { - _postConfigureServices = configureServices; + if (_postConfigureServices != null && _postConfigureServices != postConfigureServices) + { + throw new InvalidOperationException($"Do not call {nameof(PostConfigureServices)} multiple times."); + } + + _postConfigureServices = postConfigureServices; } public async Task RunOnDatabaseAsync(Func asyncAction) diff --git a/test/TestBuildingBlocks/AssemblyInfo.cs b/test/TestBuildingBlocks/Properties/AssemblyInfo.cs similarity index 100% rename from test/TestBuildingBlocks/AssemblyInfo.cs rename to test/TestBuildingBlocks/Properties/AssemblyInfo.cs diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj index ddb6edb9dc..3f16e3818e 100644 --- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj +++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj @@ -10,6 +10,7 @@ + diff --git a/test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs b/test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs new file mode 100644 index 0000000000..4b981f81d2 --- /dev/null +++ b/test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs @@ -0,0 +1,76 @@ +using Microsoft.Extensions.Logging; +using Xunit.Abstractions; + +namespace TestBuildingBlocks; + +/// +/// Writes incoming and outgoing HTTP messages to the test output window. +/// +public sealed partial class XUnitLogHttpMessageHandler : DelegatingHandler +{ + private static readonly string BodySeparator = $"{Environment.NewLine}{Environment.NewLine}"; + private readonly LoggerFactory _loggerFactory; + private readonly ILogger _logger; + + public XUnitLogHttpMessageHandler(ITestOutputHelper testOutputHelper) + { + ArgumentNullException.ThrowIfNull(testOutputHelper); + +#pragma warning disable CA2000 // Dispose objects before losing scope + // Justification: LoggerFactory.AddProvider takes ownership (passing the provider as a constructor parameter does not). + var loggerProvider = new XUnitLoggerProvider(testOutputHelper, null, LogOutputFields.Message); +#pragma warning restore CA2000 // Dispose objects before losing scope + + _loggerFactory = new LoggerFactory(); + _loggerFactory.AddProvider(loggerProvider); + + _logger = _loggerFactory.CreateLogger(); + } + + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + if (_logger.IsEnabled(LogLevel.Debug)) + { + string? requestBody = request.Content == null ? null : await request.Content.ReadAsStringAsync(cancellationToken); + + if (!string.IsNullOrEmpty(requestBody)) + { + LogRequestMessage(request.ToString(), BodySeparator, requestBody); + } + else + { + LogRequestMessage(request.ToString(), string.Empty, string.Empty); + } + } + + HttpResponseMessage response = await base.SendAsync(request, cancellationToken); + + if (_logger.IsEnabled(LogLevel.Debug)) + { + string responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + + if (!string.IsNullOrEmpty(responseBody)) + { + LogResponseMessage(response.ToString(), BodySeparator, responseBody); + } + else + { + LogResponseMessage(response.ToString(), string.Empty, string.Empty); + } + } + + return response; + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + _loggerFactory.Dispose(); + } + + [LoggerMessage(Level = LogLevel.Debug, SkipEnabledCheck = true, Message = "--> {RequestMessage}{Separator}{RequestBody}")] + private partial void LogRequestMessage(string requestMessage, string separator, string requestBody); + + [LoggerMessage(Level = LogLevel.Debug, SkipEnabledCheck = true, Message = "<-- {ResponseMessage}{Separator}{ResponseBody}")] + private partial void LogResponseMessage(string responseMessage, string separator, string responseBody); +} diff --git a/tests.runsettings b/tests.runsettings index 036b7d7044..e6790c9356 100644 --- a/tests.runsettings +++ b/tests.runsettings @@ -10,7 +10,9 @@ - ObsoleteAttribute,GeneratedCodeAttribute + **/test/**/*.* + [*]JsonApiDotNetCore.OpenApi.JsonApiObjects.* + ObsoleteAttribute,GeneratedCodeAttribute,TestSDKAutoGeneratedCode true